
<template>
	<div class="index">

		<div class="center">
			<left></left>
			<div class="right">
          <top></top>
          <div class="hei10"></div>


          <div class="where" style="background: #fff; padding: 10px 30px; font-size: 14px; color: #595959;">
            当前位置：
            <router-link to="/index" style="color: #409eff;">分销后台</router-link>>
            <router-link to="/productionDelivery" style="color: #409eff;">在售商品管理</router-link>>
            发布商品
          </div>
          <div class="hei10"></div>
<div class="addpro">
					<div class="step" v-if="allshow && !allshow2">
						<el-steps :active="2" align-center>
							<el-step title="定义基础产品信息" description="设置分类、定制生产规则"></el-step>
							<el-step title="定义销售页信息" description="对外宣传销售话术"></el-step>
							<el-step title="设定佣金及分销商可见" description="设置那些分销商可以销售，给多少佣金"></el-step>
							<el-step title="确认发布" description="上线销售发展用户"></el-step>
						</el-steps>
					</div>
          <div class="step" v-if="allshow2">
          	<el-steps :active="3" align-center>
          		<el-step title="定义基础产品信息" description="设置分类、定制生产规则"></el-step>
          		<el-step title="定义销售页信息" description="对外宣传销售话术"></el-step>
          		<el-step title="设定佣金及分销商可见" description="设置那些分销商可以销售，给多少佣金"></el-step>
          		<el-step title="确认发布" description="上线销售发展用户"></el-step>
          	</el-steps>
          </div>

					<div class="step" v-if="!showmoney&!allshow">
						<el-steps :active="1" align-center>
							<el-step title="定义销售页信息" description="对外宣传销售话术"></el-step>
							<el-step title="设定佣金及分销商可见" description="设置那些分销商可以销售，给多少佣金"></el-step>
							<el-step title="确认发布" description="上线销售发展用户"></el-step>
						</el-steps>
					</div>
					<div class="step" v-if="!showmoney">
						<div class="tilte">定义商品销售页信息</div>
						<div class="con" v-loading=loadingshop>
							<el-form ref="form" :rules="rules" @submit.native.prevent :model="shopform" label-width="180px">

								<el-form-item label="选择基础产品:" prop="proid">
									<el-select  v-model="proid" :disabled="allshow" filterable placeholder="请选择">
										<el-option v-for="item in prolists" :key="item.id" :label="item.name" :value="item.id"></el-option>
									</el-select>
									<el-checkbox style="margin-left: 20px;" v-if="this.shop_id == 50481 || this.shop_id == 304676" v-model="isxn">引流商品</el-checkbox>
								</el-form-item>

                <div class="flex w330" style="align-items: center; margin-bottom: 22px;" prop="sign_type"  v-if="shop_id == 304676 || shop_id == 50481">
                	<el-form-item label="选择签约方式:" prop="title" style="margin-bottom: 0px;">
                		<el-radio v-model="shopform.sign_type" :label="1">直签</el-radio>
                		<el-radio v-model="shopform.sign_type" :label="2">代理</el-radio>
                	</el-form-item>
                </div>

								<div class="flex w330" style="align-items: center; margin-bottom: 22px;">
									<el-form-item label="商品名称:" prop="title" style="margin-bottom: 0px;">
										<el-input v-model="shopform.title" :class="{redbor:!sub3}" @input="nijiushiwodeweiyi3" placeholder="不超过30个字"></el-input>
									</el-form-item>
                  <el-tooltip class="item" effect="light" content="对外展示的产品标题，能清晰描述概括产品，例：北京19元月租大王卡赠2GB流量" placement="top">
                    <i class="el-icon-question" style="color: rgb(64, 155, 250); font-size: 25px; margin-left: 20px; cursor: pointer;"></i>
                  </el-tooltip>
								</div>

								<el-form-item label="商家编码（抓单标识）:" prop="randomnum">
                  <div style="display: flex; align-items: center;">
                    {{randomnum}}
                    <el-button plain type="primary" size="small" style="margin: 0 10px;" @click="randomlog = true">自定义</el-button>
                    <el-tooltip class="item" effect="light" content="如果要使用自动抓单系统的话，请在电商平台将该码粘贴到产品后台的“货号（商品编码）”处。每个产品都有唯一标识"
                     placement="top">
                    	<i class="el-icon-question" style="color: rgb(64, 155, 250); font-size: 25px;  cursor: pointer;"></i>
                    </el-tooltip>
                  </div>

								</el-form-item>
								<!-- <el-form-item label="商家编码（抓单标识）:" prop="sku" style="width: 450px;">
                                    <div style="display: flex;">
                                        <el-input v-model="shopform.fetch_code" disabled=""></el-input>
                                        <el-tooltip class="item" effect="light" content="如果要使用自动抓单系统的话，请在电商平台将该码粘贴到产品后台的“货号（商品编码）”处。每个产品都有唯一标识" placement="top">
                                            <span class="wenhao" style="height: 18px; position: relative; top: 5px;">?</span>
                                        </el-tooltip>
                                    </div>
                                </el-form-item> -->
								<!-- <el-form-item label="京东特有(必须三位):" style="width: 450px;">
									<el-input v-model="jingdongrandom" maxlength="3" :class="{redbor:!sub4}" @input="nijiushiwodeweiyi4"
									 placeholder="请输入京东特用抓单码"></el-input>
								</el-form-item> -->
								<div class="flex w330" style="align-items: center; margin-bottom: 0px;">
									<el-form-item label="商品注意点:">
										<el-input v-model="shopform.points" placeholder="输入商品注意点"></el-input>
									</el-form-item>
								</div>
								<div class="flex w330" style="align-items: center; margin-bottom: 22px;">
									<el-form-item label="商品卖点:" style="margin-bottom: 0px;">
										<el-input v-model="shopform.selling_point" placeholder="输入卖点，使用逗号隔开"></el-input>
									</el-form-item>
									<el-tooltip class="item" effect="light" content="不超过3组词，例：资费低，流量大，免月租等，不宜过长" placement="top">
										<i class="el-icon-question" style="color: rgb(64, 155, 250); font-size: 25px;  margin-left: 20px; cursor: pointer;"></i>
									</el-tooltip>
								</div>
                <div class="flex">
                	<el-form-item >
                    <template slot="label">
                      <span style="color: #f00; margin-right: 5px;" v-if="shop_id == 50481 || shop_id == 304676">*</span><span>承接佣金规则:</span>
                    </template>
                    <div class="kflexc">
                      <div style="width: 330px;"><el-input v-model="shopform.expect_income_new" placeholder="承接佣金规则"></el-input></div>
                      <div style="color: rgb(64, 155, 250); margin-left: 20px; cursor: pointer;" @click="yugulog = true" >生效时间</div>
                    </div>
                	</el-form-item>
                </div>

                <el-dialog title="承接佣金规则定时生效" :visible.sync="yugulog" width="480px"  :close-on-click-modal="false" :close-on-press-escape="false">
                	  <div>
                      <el-input v-model="shopform.change_expect_income"  placeholder="承接佣金规则生效内容"></el-input>
                    </div>
                    <div>
                      <el-date-picker type="datetime" v-model="shopform.expect_income_change_at" size="medium" value-format="yyyy-MM-dd HH:mm:ss" style="margin-bottom: 20px; width: 100%; margin-top: 20px;" placeholder="承接佣金规则生效时间"></el-date-picker>
                    </div>
                	  <span slot="footer" class="dialog-footer">

                      <el-button type="primary" @click="yugulog = false">确 定</el-button>
                	  </span>
                </el-dialog>

                <div class="flex">
                	<el-form-item label="预估收益:">
                    <div class="kflexc">
                      <div style="width: 330px;"><el-input v-model="shopform.estimated_income" placeholder="预估收益"></el-input></div>
                    </div>
                	</el-form-item>
                </div>

								<div class="flex">
									<el-form-item label="结算要求:">
								    <div class="kflexc">
								      <div style="width: 330px;"><el-input v-model="shopform.commission_rule" placeholder="对外展示"></el-input></div>
								      <!-- <div style="color: rgb(64, 155, 250); margin-left: 20px; cursor: pointer;" @click="jiesuanlog = true" >生效时间</div> -->
								    </div>
									</el-form-item>
								</div>
								<!-- <el-dialog title="结算规则定时生效" :visible.sync="jiesuanlog" width="480px"  :close-on-click-modal="false" :close-on-press-escape="false">
									  <div>
								      <el-input v-model="shopform.change_commission_rule"  placeholder="结算规则生效内容"></el-input>
								    </div>
								    <div>
								      <el-date-picker type="datetime" v-model="shopform.commission_rule_change_at" size="medium" value-format="yyyy-MM-dd HH:mm:ss" style="margin-bottom: 20px; width: 100%; margin-top: 20px;" placeholder="结算规则生效时间"></el-date-picker>
								    </div>
									  <span slot="footer" class="dialog-footer">

								      <el-button type="primary" @click="jiesuanlog = false">确 定</el-button>
									  </span>
								</el-dialog> -->
                <div class="flex"  v-if="checkquanxian('P0209').length > 0">
                	<el-form-item label="佣金结算规则（内部）:">
                    <div class="kflexc">
                      <div style="width: 330px;"><el-input v-model="shopform.commission_notes" style="width: 330px;" placeholder="佣金结算规则（内部）"></el-input></div>
                      <div style="color: rgb(64, 155, 250); margin-left: 20px; cursor: pointer;" @click="jiesuanlog2 = true" >生效时间</div>
                    </div>
                	</el-form-item>
                </div>
                <el-dialog title="佣金结算规则（内部）" :visible.sync="jiesuanlog2" width="480px"  :close-on-click-modal="false" :close-on-press-escape="false">
                	  <div>
                      <el-input v-model="shopform.change_commission_notes"  placeholder="佣金结算规则（内部）"></el-input>
                    </div>
                    <div>
                      <el-date-picker type="datetime" v-model="shopform.commission_notes_change_at" size="medium" value-format="yyyy-MM-dd HH:mm:ss" style="margin-bottom: 20px; width: 100%; margin-top: 20px;" placeholder="结算规则生效时间"></el-date-picker>
                    </div>
                	  <span slot="footer" class="dialog-footer">

                      <el-button type="primary" @click="jiesuanlog2 = false">确 定</el-button>
                	  </span>
                </el-dialog>
								<!-- <div class="flex">
									<el-form-item label="拆单设置:">
                    <div class="flex">
                      <div style="display: flex; align-items: center;">
                    	<el-select  v-model="cd_number" filterable
                    		placeholder="请选择拆单数量" @change="changenumber">
                    		<el-option label="不拆单" value="0"></el-option>
                    		<el-option v-for="(item,index) in 5" :key="index" :label="item"
                    			:value="item"></el-option>
                    	</el-select>
                    	<el-tooltip class="item" effect="light"
                    		content="一单多发，单个订单给用户发货多个商品，系统会在您指定的时间执行自动拆单，拆单后的订单将按照商品编码自动匹配，并重新走审核生产流程"
                    		placement="top">
                    		<i class="el-icon-question" style="color: rgb(64, 155, 250); font-size: 25px;  margin-left: 20px; cursor: pointer;"></i>
                    	</el-tooltip>
                      </div>
                    </div>
                    <el-radio-group v-if="cd_number!='0'" v-model="cd_type_radio">
                    	<el-radio :label="3">符合条件拆单</el-radio>
                    	<el-radio :label="4">指定时间拆单</el-radio>
                    </el-radio-group>

                    <div v-for="(item,index) in split_list" :key="index"
                    	style="background: #f1f1f1; padding: 20px; margin-top:10px; border: 1px #ccc solid; color: #999; border-radius: 3px;">

                    	<div v-if="cd_type_radio==3">
                    		<div>拆分订单{{index+1}}<span v-if="index == 0"
                    			style="color: #409EFF;">(非原订单)</span>
                    		</div>
                    		<div style="padding-left: 13px;">
                    			当“<span v-if="index == 0">原订单</span><span v-else>拆分订单{{index}}</span>”订单状态变更为“<span style="color: #EEF7FF;">生产失败</span>“时，则执行本次拆单<span style="color: #AFAFAF;">（每10分钟执行一次）</span>
                    		</div>
                    		<div class="flex">
                    			<div style="width: 140px; text-align: right; margin-right: 20px;">拆分订单所属商品：</div>
                    			<div>
                    				<el-input v-model="item.sku" style="width: 250px;" placeholder="商品编码"></el-input>
                    			</div>
                    		</div>
                    	</div>

                    	<div v-if="cd_type_radio==4" >
                    		<div>拆分订单{{index+1}}<span v-if="index == 0"
                    			style="color: #409EFF;">(非原订单)</span></div>
                    		<div class="flex">
                    			<div style="width: 140px; text-align: right; margin-right: 20px;">拆单执行时间：</div>
                    			<div  class="zidong">原订单进入{{moban.platform_name}}系统<el-input v-model="item.later" min="0" type="number" class="w100" style="width: 100px; margin: 0 10px;">
                    				</el-input>小时后拆单</div>
                    		</div>
                    		<div class="flex">

                    			<div style="width: 140px; text-align: right; margin-right: 20px;">拆分订单所属商品：</div>
                    			<div>
                    				<el-input v-model="item.sku" style="width: 250px;"  class="w250" placeholder="商品编码"></el-input>
                    			</div>
                    		</div>
                    		<div class="flex">
                    			<div style="width: 140px; text-align: right; margin-right: 20px;">拆单前检测：</div>
                    			<div>
                    				<el-checkbox v-model="item.check_deliver">拆分执行时，若
                    					<span style="color: #409EFF;" v-if="index == 0">原订单</span>
                    					<span style="color: #409EFF;"
                    						v-if="index != 0">拆分订单{{index}}</span>

                    					已发货成功，则该订单不再拆分
                    				</el-checkbox>
                    			</div>
                    		</div>
                    	</div>



                    </div>

                    <div v-if="cd_number!='0'">
                    	<div v-if="cd_type_radio==3" style="color: #B4B4B4; line-height: 35px;">
                    		<div>拆单说明：</div>
                    		<div>1、反复失败的订单只会在第一次失败拆分，后续失败不会拆分</div>
                    		<div>2、若”拆分订单1”不满足条件未拆分，则后续拆分订单2、3都不会执行拆分</div>
                    		<div>3、拆分订单为独立订单与原订单没有关联关系</div>
                    		<div>4、拆分定单在外部订单号后增加”-CF1”字样用以区分</div>
                    	</div>

                    	<div v-if="cd_type_radio==4" style="color: #B4B4B4; line-height: 35px;">
                    		<div>拆单说明：</div>
                    		<div>1、拆分订单1、2同时勾选“拆单前检测”后“拆分订单1”拆单失败不影响“拆分订单2”的拆单，拆分订单2会成功拆单。</div>
                    		<div>2、拆分后的订单完全独立，原订单执行删除、修改订单状态等不会影响拆分订单</div>
                    		<div>3、拆单功能只针对自己发展的订单，无法拆单分销商发展订单</div>
                    		<div>4、拆分订单不会去电商平台同步发货信息，只在{{moban.platform_name}}有发货记录</div>
                    	</div>
                    </div>

									</el-form-item>
								</div> -->
								<!-- 拆单设置 -->
								<!-- <zdzd    @changesw="changesw" @surecreate="surecreate" @handleChange="handleChange" :wwidth="'330px'"></zdzd> -->
								<el-form-item label="销售页上传照片:" class="label200">
                  <div style="display: flex; align-items: center;">
                    <el-radio-group v-model="shopform.is_need_photo">
                    	<el-radio label="0">无需上传</el-radio>
                    	<el-radio label="1">需要上传</el-radio>
                    </el-radio-group>
                    <el-tooltip class="item" effect="light" content="仅设置是否需要在销售页下单时上传照片，选择无需上传可在批量上传照片处另行导入。" placement="top">
                    	<i class="el-icon-question" style="color: rgb(64, 155, 250); font-size: 25px;  margin-left: 20px; cursor: pointer;"></i>
                    </el-tooltip>
                  </div>

								</el-form-item>
								<div class="flex">
									<el-form-item label="产品主图:">
										<!-- <el-upload class="avatar-uploader" action="https://jsonplaceholder.typicode.com/posts/" :on-change="uploadok"
										 :auto-upload="false" :show-file-list="false">
											<img v-if="shopform.image1" :src="shopform.image1" class="avatar">
											<i v-else class="el-icon-plus avatar-uploader-icon"></i>
										</el-upload> -->

                    <chuantu2 v-if="chuantushow"  :imgs="shopform.image1" @getimg="getimg"></chuantu2>


                    <!-- <el-button type="text" @click="goid('/productionDelivery/shengchengtu')">自定义产品主图设置</el-button> -->

									</el-form-item>
								</div>
                <div class="flex" style="align-items: center;">
                	<el-form-item label="商品分享图:">
                		<!-- <el-upload class="avatar-uploader" action="https://jsonplaceholder.typicode.com/posts/" :on-change="uploadok2"
                		 :auto-upload="false" :show-file-list="false">
                			<img v-if="shopform.share_img" :src="shopform.share_img" class="avatar">
                			<i v-else class="el-icon-plus avatar-uploader-icon"></i>
                		</el-upload> -->
                    <chuantu v-if="chuantushow"  :imgs="shopform.share_img" @getimg="getimg2"></chuantu>
                	</el-form-item>
                  <el-tooltip class="item" effect="light" content="该图用于微小店分享商品处向用户说明产品优点。" placement="top">
                    <i class="el-icon-question" style="color: rgb(64, 155, 250); font-size: 25px;  margin-left: 20px; cursor: pointer;"></i>
                  </el-tooltip>
                </div>
								<el-form-item label="商品详情:" prop="name">
									<div id="editor">

									</div>
								</el-form-item>
								<el-form-item label="其他备注:">
									<div id="editorE">

									</div>
								</el-form-item>

                <!-- //新增模块 -->
                <div>
                  <div style="padding: 20px 0; font-size: 16px; font-weight: bold;">套餐详情</div>

                	<el-form-item label="月租：">
                		<el-input v-model="shopform.yuezu" placeholder="请输入月租"></el-input>
                	</el-form-item>
                  <el-form-item label="语音通话：">
                  	<el-input v-model="shopform.yuyin" placeholder="请输入语音通话"></el-input>
                  </el-form-item>
                	<el-form-item label="通用流量：">
                		<el-input v-model="shopform.liuliang" placeholder="请输入通用流量"></el-input>
                	</el-form-item>
                	<el-form-item label="定向流量：">
                		<el-input v-model="shopform.dx_liuliang" placeholder="请输入定向流量"></el-input>
                	</el-form-item>
                  <el-form-item label="归属地：">
                    <dizhi @xuanzhongde="xuanzhongde" :guishudi_code="shopform.guishudi_code"></dizhi>
                  </el-form-item>

                  <el-form-item label="套餐详细信息:">
                  	<div id="editorE2">

                  	</div>
                  </el-form-item>


<!--                	<el-form-item label="套餐优惠期:" >
                    <div class="l2 kflexc zidong">
                      <el-select  v-model="shopform.yuezu_time" placeholder="输入月" style="width: 100px; margin-right: 10px;">
                        <el-option :value="item" v-for="item in 36" :key="item" :label="item + '个月'"></el-option>
                      </el-select>
                      <div style="margin-right: 10px; color: rgb(51, 51, 51);">优惠期起始时间：</div>
                      <div style="margin-right: 10px; color: rgb(147, 147, 147);">自激活起</div>
                      <el-select  v-model="shopform.yuezu_type" placeholder="输入月" style="width: 100px; margin-right: 10px;">
                        <el-option value="1" label="当月"></el-option>
                        <el-option value="2" label="次月"></el-option>
                        <el-option value="3" label="第三月"></el-option>
                      </el-select>
                      <div style="margin-right: 10px; color: rgb(147, 147, 147);">开始</div>
                    </div>
                	</el-form-item>
                  <el-form-item label="佣金结算周期:" >
                    <div class="l2 kflexc zidong">
                      <el-select  v-model="shopform.yongjin_time" placeholder="输入月" style="width: 100px; margin-right: 10px;">
                        <el-option :value="item" v-for="item in 36" :key="item" :label="item + '个月'"></el-option>
                      </el-select>
                      <div style="margin-right: 10px; color: rgb(51, 51, 51);">&nbsp;&nbsp;&nbsp;&nbsp;结算起始时间：</div>
                      <div style="margin-right: 10px; color: rgb(147, 147, 147);">自激活起</div>
                      <el-select  v-model="shopform.yongjin_type" placeholder="输入月" style="width: 100px; margin-right: 10px;">
                        <el-option value="1" label="当月"></el-option>
                        <el-option value="2" label="次月"></el-option>
                        <el-option value="3" label="第三月"></el-option>
                      </el-select>
                      <div style="margin-right: 10px; color: rgb(147, 147, 147);">开始</div>
                    </div>
                  </el-form-item>
                  <el-form-item label="返利方式:" >



                    <div class="kflexc" style="margin-bottom: 20px;">
                      <div><el-radio v-model="shopform.fanli_money_type" :label="0">每月相同反费额度</el-radio></div>
                      <div class="kflexc zhouqi" style="margin-left: 20px;">
                          <div style="color: rgb(147, 147, 147); margin-right: 10px;">返费周期:</div>
                          <div>
                            <el-select v-model="shopform.fanli_time" placeholder="输入月">
                              <el-option :value="item" v-for="item in 36" :key="item" :label="item + '个月'"></el-option>
                            </el-select>
                          </div>
                          <div style="margin-right: 10px; color: rgb(51, 51, 51); margin-left: 20px;">返利起始时间：</div>
                          <div style="margin-right: 10px; color: rgb(147, 147, 147);">自激活起</div>
                          <el-select v-model="shopform.fanli_type" placeholder="输入月" style=" margin-right: 10px;">
                            <el-option :value="1" label="当月"></el-option>
                            <el-option :value="2" label="次月"></el-option>
                            <el-option :value="3" label="第三月"></el-option>
                          </el-select>
                          <div style="margin-right: 10px; color: rgb(147, 147, 147);">开始</div>
                          <div style="margin-right: 10px; color: rgb(147, 147, 147);">每月返费金额</div>
                          <div style="margin-right: 10px; color: rgb(147, 147, 147);"><el-input v-model="shopform.fanli_money" placeholder="请输入金额"></el-input></div>
                      </div>

                    </div>


                    <div class="kflex" style=" margin-bottom: 20px;">
                      <div><el-radio v-model="shopform.fanli_money_type" :label="1">每月不同返费额度</el-radio></div>
                      <div style="margin-left: 20px;">
                        <div class="kflexc" v-for="(item,index) in fanli_money_array" :key="index" style="margin-bottom: 10px;">
                          <div v-if="index == 0">激活当月</div>
                          <div v-if="index == 1">激活次月</div>
                          <div v-if="index != 0 && index != 1">第{{index+1}}个月</div>
                          <div style="margin-left: 10px;"><el-input v-model="fanli_money_array[index]" type="number" placeholder="请输入金额"></el-input></div>
                        </div>
                        <el-button type="text" @click="changefanli_money_array()">+ 添加月份</el-button>
                      </div>
                    </div>
                  </el-form-item>

                  <el-form-item label="更新历史订单数据:" >
                  	<div class="kflexc">
                  	  <div>
                  	                    	  <el-date-picker v-model="times" @change="timechange" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期"  end-placeholder="结束日期"></el-date-picker>
                  	                    	</div>
                  	                      <el-tooltip class="item" effect="dark"  style="margin-left: 20px;" content="说明：该功能会根据你设置的时间点追溯历史订单，把设置返利数据之前的历史订单按照当前设置数据重新计算并加入到返利池中（通常用于之前忘记设置，后来补充设置返利）
                  	  注：操作前请确保已完整正确设置返利数据。" placement="top-start">
                  	                      	<i class="el-icon-question" style="color: #409EFF; font-size: 20px; margin-left: 5px; cursor: pointer;" ></i>
                  	                      </el-tooltip>
                  	</div>
                  </el-form-item>

				  <el-form-item label="返费方式:" >
				  	<div style="margin-left: 20px;">
				  	  <el-select v-model="shopform.is_rebate" placeholder="输入返费方式" style="margin-right: 10px;">
				  	    <el-option :value="3" label="领取返费"></el-option>
				  	    <el-option :value="2" label="自动返费"></el-option>
				  	    <el-option :value="0" label="不使用返利系统"></el-option>
				  	  </el-select>
				  	</div>
				  </el-form-item> -->
                </div>
                <!-- //到这里 -->
							</el-form>
						</div>
					</div>
					<div class="step" v-if="!showmoney" style="text-align: center;">
						<el-button style="padding: 9px 30px !important; line-height: 14px !important;" @click="jiancha(0)">下一步</el-button>
						<el-button type="danger" @click="jiancha(1)">设置佣金且上架</el-button>
					</div>




					<div class="step" v-if="showmoney">
						<div class="tilte">定义佣金及分销商可见</div>
						<div class="con">
							<el-form ref="form" :rules="rules" @submit.native.prevent :model="moneyform" label-width="150px">
								<el-form-item label="分销商可见设置:" prop="visible">
									<div style="display: flex;">
										<div style="background-color:#F6F6F6;padding: 20px;">
											<el-radio-group v-model="moneyform.visible" @change="cardid">
												<el-radio label="1">仅自己可见</el-radio>
												<el-radio label="2">全部分销商可见</el-radio>
												<el-radio label="3">选择的分销商可见</el-radio>
												<el-radio label="4">选择的分销商不可见</el-radio>
											</el-radio-group>
											<div v-if="kejian">
												<span style="color: #333333;margin-right: 20px;">已选择：{{moneyform.child_shop_ids.length}}条 </span><el-button @click="openchoosefx(1)" type="text">编辑</el-button>
											</div>
										</div>
										<div class="t_out_tips_box">
											<div style="color: #409EFF;">默认不可见商户:3条</div>
											<el-popover
												placement="top-start"
												title=""
												width="400"
												trigger="hover"
												content="不论选择全部分销商可见，还是指定分销商不可见，在小黑屋里面的分销商都不可见,除非指定分销商可见小黑屋的商户才可见。">
												<div slot="reference" class="t_wen">?</div>
											</el-popover>
										</div>
									</div>

								</el-form-item>
								<!-- <el-form-item label="选择分销商:" v-if="kejian" @change="chakan">
									<el-select v-model="moneyform.child_shop_ids" multiple collapse-tags placeholder="请选择分销商:">
										<el-option v-for="item in moneyform.dislist" :key="item.child_shop_id" :label="item.name" :value="item.child_shop_id"></el-option>
									</el-select>
								</el-form-item> -->
								<!-- <div class="flex btm0">
									<el-form-item label="佣金额度:" prop="commission">
										<el-input v-model="moneyform.commission" type="number" placeholder="佣金额度"></el-input>
									</el-form-item>
									<el-button type="primary"  size="mini" plain @click="log = true">分销商差异化佣金设置</el-button>
									<el-tooltip class="item" effect="light" content="给予分销商的佣金额度" placement="top">
										<span class="wenhao" style="display: block; height: 29px; width: 29px; padding: 0; line-height: 29px; margin-top: 5px;">?</span>
									</el-tooltip>
								</div> -->
								<el-form-item label="佣金规则设置:">
									<div v-for="item in bianjiyongjinlist" :key="item.id">
										<div v-if="item.type == 1" class="bor3">{{item.name}}：
											<span style="color: #409EFF; margin-right: 30px;">
												<span v-if="item.rules != ''">{{item.rules}}</span>
												<span v-if="item.active_commission > 0">已激活，佣金{{item.active_commission}}元。</span>
												<span v-if="item.first_recharge_one > 0">首充大于{{item.first_recharge_one}}元，佣金{{item.first_recharge_one_commission}}元。</span>
												<span v-if="item.first_recharge_two > 0">首充大于{{item.first_recharge_two}}元，佣金{{item.first_recharge_two_commission}}元。</span>
												<span v-if="item.recharge_amount_one > 0">累计充值大于{{item.recharge_amount_one}}元，佣金{{item.recharge_amount_one_commission}}元。</span>
												<span v-if="item.recharge_amount_two > 0">累计充值大于{{item.recharge_amount_two}}元，佣金{{item.recharge_amount_two_commission}}元。</span>
											</span>
											<el-button type="primary" size="mini" @click="bianjiyongjinchange(item)">编辑</el-button>
										</div>
									</div>
									<div v-for="item in bianjiyongjinlist" :key="item.id + 'x'">
										<div v-if="item.type == 3" class="bor4">{{item.name}}：
											<span style="color: #409EFF; margin-right: 30px;">
												<span v-if="item.rules != ''">{{item.rules}}</span>
												<span v-if="item.active_commission > 0">已激活，佣金{{item.active_commission}}元。</span>
												<span v-if="item.first_recharge_one > 0">首充大于{{item.first_recharge_one}}元，佣金{{item.first_recharge_one_commission}}元。</span>
												<span v-if="item.first_recharge_two > 0">首充大于{{item.first_recharge_two}}元，佣金{{item.first_recharge_two_commission}}元。</span>
												<span v-if="item.recharge_amount_one > 0">累计充值大于{{item.recharge_amount_one}}元，佣金{{item.recharge_amount_one_commission}}元。</span>
												<span v-if="item.recharge_amount_two > 0">累计充值大于{{item.recharge_amount_two}}元，佣金{{item.recharge_amount_two_commission}}元。</span>
											</span>
											<el-button type="primary" size="mini" @click="bianjiyongjinchange(item)">编辑</el-button>
										</div>
									</div>
									<div>
										<el-button type="primary" size="mini" @click="bianjiyongjinlogshow">新增佣金规则</el-button>
									</div>
								</el-form-item>
								<el-form-item label="佣金规则设置:">
									<el-button type="primary" size="mini" @click="zhidingguize">为分销商指定规则</el-button>
								</el-form-item>
								<el-form-item label="提卡费:">
									<el-input class="x" v-model="moneyform.tika_cost" @input='dayu0' type="number" style="width: 200px;" placeholder="提卡费"></el-input>
									<span style="color: #999; margin-left: 20px;">根据设置金额向分销商收取提卡费</span>
								</el-form-item>
								<el-form-item label="上架通知:" class="shangjia" >

									<el-checkbox v-model="moneyform.is_notice">给可见商品的分销商发送新商品上架通知</el-checkbox>

								</el-form-item>
							</el-form>
						</div>
					</div>
					<div class="step" v-if="showmoney" style="text-align: center;">
						<el-button type="danger" @click="bangding()">发布商品</el-button>
					</div>

				</div>
			</div>
		</div>
		<el-dialog :title="tit" :visible.sync="bianjiyongjinlog" :before-close="bianliyongjinlogclose" :close-on-click-modal="false" :close-on-press-escape="false" width="920px">
		      <div style="margin-bottom: 20px; display: flex; ">
		          <div style="width: 120px; line-height: 36px;">规则名称：</div>
		          <div v-if="bianjiyongjinlist.length == 0 "><el-input v-model="first_rules.name" disabled placeholder="请输入规则名称"></el-input></div>
		          <div v-if="bianjiyongjinlist.length != 0 "><el-input v-model="first_rules.name" placeholder="请输入规则名称"></el-input></div>
		      </div>
		      <div style="margin-bottom: 20px; display: flex; ">
		        <div style="width: 120px; line-height: 36px;">佣金描述：</div>
		        <div><el-input v-model="first_rules.rules" placeholder="请输入佣金描述"></el-input></div>
		      </div>
		      <div style="margin-bottom: 20px; display: flex;">
		          <div style="width: 120px; line-height: 36px;">规则定义：</div>
		          <div class="newcon">
		                <div class="newflex">
		                    <div class="newflexli1" style="padding: 15px 0;">满足条件</div>
		                    <div class="newflexli2" style="padding: 15px 0;">支出佣金</div>
		                </div>
		                <div class="newflex">
		                    <div class="newflexli1 newflex2">
		                        <div class="newflexli11"><el-checkbox v-model="active"  @change="change_active">已激活</el-checkbox></div>
		                        <div class="newflexli12">  </div>
		                    </div>
		                    <div class="newflexli2"><el-input  type="number" :disabled="!active"  v-model="first_rules.active_commission" @input="inputchoose"  placeholder="请输入金额"></el-input></div>
		                </div>
		                <div class="newflex">
		                    <div class="newflexli1 newflex2">
		                        <div class="newflexli11"><el-checkbox v-model="first_recharge" @change="change_first_recharge">已首充</el-checkbox></div>
		                        <div class="newflexli12">
		                            <div>充值≥：<el-input :disabled="!first_recharge" v-model="first_rules.first_recharge_one" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                            <div>充值≥：<el-input :disabled="!first_recharge" v-model="first_rules.first_recharge_two" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                        </div>
		                    </div>
		                    <div class="newflexli2">
		                        <div><el-input :disabled="!first_recharge" v-model="first_rules.first_recharge_one_commission" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                        <div><el-input :disabled="!first_recharge" v-model="first_rules.first_recharge_two_commission" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                    </div>
		                </div>
		                <div class="newflex">
		                    <div class="newflexli1 newflex2">
		                        <div class="newflexli11"><el-checkbox v-model="recharge_amount"  @change="change_recharge_amount">累计充值金额</el-checkbox></div>
		                        <div class="newflexli12">
		                            <div>充值≥：<el-input :disabled="!recharge_amount" v-model="first_rules.recharge_amount_one" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                            <div>充值≥：<el-input :disabled="!recharge_amount" v-model="first_rules.recharge_amount_two" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                        </div>
		                    </div>
		                    <div class="newflexli2">
		                        <div><el-input :disabled="!recharge_amount" v-model="first_rules.recharge_amount_one_commission" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                        <div><el-input :disabled="!recharge_amount" v-model="first_rules.recharge_amount_two_commission" @input="inputchoose" placeholder="请输入金额"></el-input></div>
		                    </div>
		                </div>

		          </div>
		        </div>
		          <div class="newalt" style="margin-top: 20px;">
		            当前设定规则：
		            <span v-if="first_rules.rules != ''">{{first_rules.rules}}</span>
		            <span v-if="active == true">已激活，佣金{{first_rules.active_commission}}元.</span>
		            <span v-if="first_recharge == true">首充大于等于{{first_rules.first_recharge_one}}元，佣金{{first_rules.first_recharge_one_commission}}元</span>
		            <span v-if="first_recharge == true">或者首充大于等于{{first_rules.first_recharge_two}}元，佣金{{first_rules.first_recharge_two_commission}}元.</span>
		            <span v-if="recharge_amount == true">累计充值大于等于{{first_rules.recharge_amount_one}}元，佣金{{first_rules.recharge_amount_one_commission}}元</span>
		            <span v-if="recharge_amount == true">且累计充值大于等于{{first_rules.recharge_amount_two}}元，佣金{{first_rules.recharge_amount_two_commission}}元.</span>
		          </div>

		          <div class="newalt" style="margin-top: 20px;" v-if="first_rules.start_at">
		            定时生效： <span>{{first_rules2.start_at}}</span>
		            <span v-if="first_rules2.rules != ''">{{first_rules2.rules}}</span>
		            <span v-if="first_rules2.active_commission != 0 ">已激活，佣金{{first_rules2.active_commission}}元.</span>
		            <span v-if="first_rules2.first_recharge_one != 0 || first_rules2.first_recharge_one_commission != 0 ">首充大于等于{{first_rules2.first_recharge_one}}元，佣金{{first_rules2.first_recharge_one_commission}}元</span>
		            <span v-if="first_rules2.first_recharge_two != 0  || first_rules2.first_recharge_two_commission != 0 ">或者首充大于等于{{first_rules2.first_recharge_two}}元，佣金{{first_rules2.first_recharge_two_commission}}元.</span>
		            <span v-if="first_rules2.recharge_amount_one != 0  || first_rules2.recharge_amount_one_commission != 0 ">累计充值大于等于{{first_rules2.recharge_amount_one}}元，佣金{{first_rules2.recharge_amount_one_commission}}元</span>
		            <span v-if="first_rules2.recharge_amount_two != 0  || first_rules2.recharge_amount_two_commission != 0 ">且累计充值大于等于{{first_rules2.recharge_amount_two}}元，佣金{{first_rules2.recharge_amount_two_commission}}元.</span>
		          </div>

		      <span slot="footer" class="dialog-footer">
		      	<el-button @click="bianjiyongjinlog = false">取 消</el-button>
		        <el-button type="primary" @click="savefanli2" v-if="tit == '修改佣金规则'">定时生效</el-button>
		      	<el-button type="primary" @click="savefanli" v-if="!first_rules.start_at">立即生效</el-button>
		      </span>
		</el-dialog>
		<!-- <el-dialog title="编辑分销商佣金111" :visible.sync="zidingyilog" :close-on-press-escape="false" :close-on-click-modal="false"
		 width="800px">
			<div class="zidingyiflex">
				<el-input placeholder="分销商店铺名" v-model="search" style="width: 250px; margin-right: 10px;"></el-input>
				<el-button type="primary" @click="searchgo" style="padding: 10px 20px;" icon="el-icon-search"></el-button>
			</div>
			<div class="zidingyiflex" style="background: #EAEAEA; margin-top: 20px;">
				<div class="zidingyitd">分销商店铺</div>
				<div class="zidingyitd" style="flex:3;">当前佣金</div>
				<div class="zidingyitd">编辑</div>
			</div>
			<div class="zidingyiflex" v-for="item in shoplist" :key="item.child_shop_id">
				<div class="zidingyitd">{{item.merchant_name}}</div>
				<div class="zidingyitd" v-if="item.config_id == 0 || item.config_id == null" style="flex:3;">
					<span>默认规则：</span>
					<span v-if="morenyongjin.rules != ''">{{morenyongjin.rules}}</span>
					<span v-if="morenyongjin.active_commission > 0">已激活，佣金{{morenyongjin.active_commission}}元.</span>
					<span v-if="morenyongjin.first_recharge_one > 0">首充大于{{morenyongjin.first_recharge_one}}元，佣金{{morenyongjin.first_recharge_one_commission}}元</span>
					<span v-if="morenyongjin.first_recharge_two > 0">或者首充大于{{morenyongjin.first_recharge_two}}元，佣金{{morenyongjin.first_recharge_two_commission}}元.</span>
					<span v-if="morenyongjin.recharge_amount_one > 0">累计充值大于{{morenyongjin.recharge_amount_one}}元，佣金{{morenyongjin.recharge_amount_one_commission}}元</span>
					<span v-if="morenyongjin.recharge_amount_two > 0">且累计充值大于{{morenyongjin.recharge_amount_two}}元，佣金{{morenyongjin.recharge_amount_two_commission}}元.</span>
				</div>
				<div class="zidingyitd" v-if="item.config_id != 0 && item.config_id != null" style="flex:3;">
					<span>{{item.name}}：</span>
					<span v-if="item.rules != ''">{{item.rules}}</span>
					<span v-if="item.active_commission > 0">已激活，佣金{{item.active_commission}}元.</span>
					<span v-if="item.first_recharge_one > 0">首充大于{{item.first_recharge_one}}元，佣金{{item.first_recharge_one_commission}}元</span>
					<span v-if="item.first_recharge_two > 0">或者首充大于{{item.first_recharge_two}}元，佣金{{item.first_recharge_two_commission}}元.</span>
					<span v-if="item.recharge_amount_one > 0">累计充值大于{{item.recharge_amount_one}}元，佣金{{item.recharge_amount_one_commission}}元</span>
					<span v-if="item.recharge_amount_two > 0">且累计充值大于{{item.recharge_amount_two}}元，佣金{{item.recharge_amount_two_commission}}元.</span>
				</div>
				<div class="zidingyitd">
					<el-button @click="zidingyibianji(item.config_id,item.child_shop_id)">编辑</el-button>
				</div>

			</div>
		</el-dialog> -->
		<el-dialog title="自定义编辑" :visible.sync="zidingyixuanzelog" :close-on-press-escape="false" :close-on-click-modal="false"
		 width="800px">
			<div v-for="item in bianjiyongjinlist" :key="item.id">
				<el-radio v-model="zidingyiradio" :label="item.id" style="margin: 20px;">{{item.name}}</el-radio>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button @click="zidingyixuanzelog = false">取 消</el-button>
				<el-button type="primary" @click="zidingyiradiook">确 定</el-button>
			</span>
		</el-dialog>
		<el-dialog title="自定义抓单ID" :visible.sync="randomlog" width="400px">
			<div class="randomdiv">
				<el-input v-model="randomvalue" @input="randomnumwrite" placeholder="自定义抓单ID"></el-input>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button @click="randomlog = false">取 消</el-button>
				<el-button type="primary" @click="randomgo" :disabled="randomone">确 定</el-button>
			</span>
		</el-dialog>
		<el-dialog title="自定义产品类型" :visible.sync="taglog" width="400px">
			<div class="protag">
				<el-tag :key="item.id" v-for="item in typelist" closable :disable-transitions="false" @close="handleClose(item.name)">{{item.name}}</el-tag>
				<el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
				 @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
				</el-input>
				<el-button v-else class="button-new-tag" size="small" @click="showInput">输入自定义名称</el-button>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible = false">取 消</el-button>
				<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
			</span>
		</el-dialog>
		<el-dialog title="编辑分销商佣金" :visible.sync="log" width="600px">
			<div class="loglist">
				<div class="log_title">{{shopform.title}}产品的佣金设置</div>
				<div class="search">
					<el-input placeholder="请输入佣金" v-model="search" class="input-with-select">
						<el-button slot="append" icon="el-icon-search"></el-button>
					</el-input>
				</div>
			</div>

			<div class="con" v-loading="loading">
				<div class="list">
					<div class="th">分销商店铺</div>
					<div class="th">佣金</div>
				</div>
				<div class="listl">
					<!-- 佣金设置列表 -->
					<div class="list" v-for="item in moneyform.list" :key="item.child_shop_id">
						<div class="td">{{item.name}}</div>

						<div class="td" v-if="item.commission_is_set == 1?true:false">
							{{item.commission}}
							<el-button type="primary" size="mini" plain style=" margin-left: 30px;" @click="fixmoney(item.child_shop_id)">修改</el-button>
						</div>
						<div class="td" v-if="item.commission_is_set != 1?true:false">
							默认佣金
							<el-button type="primary" size="mini" plain style=" margin-left: 30px;" @click="fixmoney(item.child_shop_id)">修改</el-button>
						</div>
					</div>

				</div>
			</div>

			<span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="log = false">确定</el-button>
			</span>
		</el-dialog>
    <el-dialog title="定时生效时间设置" :visible.sync="dingshilog" :close-on-press-escape="false" :close-on-click-modal="false" width="600px">
        <el-date-picker v-model="dingshi" type="datetime" value-format="yyyy-MM-dd HH:mm" placeholder="选择日期时间"></el-date-picker>
        <span slot="footer" class="dialog-footer">
        	<el-button @click="dingshilog = false">取 消</el-button>
        	<el-button type="primary" @click="savefanli2ok">确 定</el-button>
        </span>
    </el-dialog>

    <el-dialog title="编辑分销商佣金" :visible.sync="zidingyilog" :close-on-press-escape="false" :close-on-click-modal="false" width="800px">

      <el-tabs v-model="activeName" type="card" @tab-click="handleClick">

          <el-tab-pane label="按佣金规则指定" name="first">
              <el-table :data="bianjiyongjinlist" border style="width: 100%">
                  <el-table-column prop="name" label="规则名称" width="180"></el-table-column>
                  <el-table-column>
                    <template slot-scope="scope">
                           <span v-if="scope.row.rules != ''">{{scope.row.rules}}</span>
                           <span v-if="scope.row.active_commission > 0">已激活，佣金{{scope.row.active_commission}}元。</span>
                           <span v-if="scope.row.first_recharge_one > 0">首充大于{{scope.row.first_recharge_one}}元，佣金{{scope.row.first_recharge_one_commission}}元。</span>
                           <span v-if="scope.row.first_recharge_two > 0">首充大于{{scope.row.first_recharge_two}}元，佣金{{scope.row.first_recharge_two_commission}}元。</span>
                           <span v-if="scope.row.recharge_amount_one > 0">累计充值大于{{scope.row.recharge_amount_one}}元，佣金{{scope.row.recharge_amount_one_commission}}元。</span>
                           <span v-if="scope.row.recharge_amount_two > 0">累计充值大于{{scope.row.recharge_amount_two}}元，佣金{{scope.row.recharge_amount_two_commission}}元。</span>
                    </template>
                  </el-table-column>
                  <el-table-column>
                    <template slot-scope="scope">
						<span>已选择：85条</span>
						<el-button type="text" size="mini" @click="openchoosefx(2,scope.row)">新管理</el-button>
                        <el-button type="text" size="mini" @click="guanli(scope.row)">管理</el-button>
                    </template>
                  </el-table-column>
              </el-table>
          </el-tab-pane>
		  <el-tab-pane label="按分销商指定" name="second">
            <div class="zidingyiflex">
                <el-input placeholder="分销商店铺名" v-model="search" style="width: 250px; margin-right: 10px;"></el-input>
                <el-button type="primary" @click="searchgo" style="padding: 10px 20px;" icon="el-icon-search"></el-button>
            </div>
            <div class="zidingyiflex" style="background: #EAEAEA; margin-top: 20px;">
                <div class="zidingyitd">分销商店铺</div>
                <div class="zidingyitd" style="flex: 3;">当前佣金</div>
                <div class="zidingyitd">编辑</div>
            </div>
            <div class="zidingyiflex"  v-for="item in shoplist" :key="item.child_shop_id">

                <div class="zidingyitd">{{item.merchant_name}}</div>
                <div class="zidingyitd" v-if="item.config_id == 0" style="flex: 3;">
                    <span>默认规则：</span>
                    <span v-if="morenyongjin.rules != ''">{{morenyongjin.rules}}</span>
                    <span v-if="morenyongjin.active_commission > 0">已激活，佣金{{morenyongjin.active_commission}}元.</span>
                    <span v-if="morenyongjin.first_recharge_one > 0">首充大于{{morenyongjin.first_recharge_one}}元，佣金{{morenyongjin.first_recharge_one_commission}}元或者</span>
                    <span v-if="morenyongjin.first_recharge_two > 0">首充大于{{morenyongjin.first_recharge_two}}元，佣金{{morenyongjin.first_recharge_two_commission}}元.</span>
                    <span v-if="morenyongjin.recharge_amount_one > 0">累计充值大于{{morenyongjin.recharge_amount_one}}元，佣金{{morenyongjin.recharge_amount_one_commission}}元且</span>
                    <span v-if="morenyongjin.recharge_amount_two > 0">累计充值大于{{morenyongjin.recharge_amount_two}}元，佣金{{morenyongjin.recharge_amount_two_commission}}元.</span>
                </div>
                <div class="zidingyitd" v-if="item.config_id != 0" style="flex: 3;">
                  <span>{{item.name}}：</span>
                  <span v-if="item.rules != ''">{{item.rules}}</span>
                  <span v-if="item.active_commission > 0">已激活，佣金{{item.active_commission}}元.</span>
                  <span v-if="item.first_recharge_one > 0">首充大于{{item.first_recharge_one}}元，佣金{{item.first_recharge_one_commission}}元或者</span>
                  <span v-if="item.first_recharge_two > 0">首充大于{{item.first_recharge_two}}元，佣金{{item.first_recharge_two_commission}}元.</span>
                  <span v-if="item.recharge_amount_one > 0">累计充值大于{{item.recharge_amount_one}}元，佣金{{item.recharge_amount_one_commission}}元且</span>
                  <span v-if="item.recharge_amount_two > 0">累计充值大于{{item.recharge_amount_two}}元，佣金{{item.recharge_amount_two_commission}}元.</span>
                </div>
                <div class="zidingyitd" ><el-button type="text" @click="zidingyibianji(item.config_id,item.child_shop_id)">编辑</el-button></div>

            </div>
          </el-tab-pane>
      </el-tabs>

    </el-dialog>
    <el-dialog title="根据佣金规则管理代理商" :visible.sync="guizelistlog" :close-on-press-escape="false" :close-on-click-modal="false" width="800px">
        <el-button type="primary" size="mini" @click="tianjiadailishang()">添加代理商</el-button>
        <el-table :data="genjuguize" border style="width: 100%; margin-top: 20px;">
            <el-table-column prop="merchant_name" label="代理商" ></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                  <el-button type="primary" size="mini" @click="guanlishan(scope.row)" v-if="scope.row.type == 3">删除</el-button>
              </template>
            </el-table-column>
        </el-table>
    </el-dialog>

    <el-dialog title="根据佣金规则管理代理商" :visible.sync="tianjiadailishanglog" :close-on-press-escape="false" :close-on-click-modal="false" width="800px">
        <el-select style="width:330px" v-model="xin.child_shop_id" filterable placeholder="请选择">
            <el-option v-for="item in shoplist" :key="item.child_shop_id" :label="item.merchant_name"  :value="item.child_shop_id"> </el-option>
        </el-select>
        <span slot="footer" class="dialog-footer">
        	<el-button @click="tianjiadailishanglog = false">取 消</el-button>
        	<el-button type="primary" @click="tianjiadailishanggo">确 定</el-button>
        </span>
    </el-dialog>
		<!-- <foot></foot> -->
		<!-- 选择分销商弹窗 -->
		<el-dialog
      title="指定分销商"
      :visible.sync="isshowfxs"
      width="800px">
      <div class="t_fenxiao_all">
        <div class="t_fx_tab" >
          <el-input  @input="shaipeo" v-model="searchallpeo" v-if="fxtype==1||fxtype==3||fxtype==5" style="margin-top: 30px;" size="small" placeholder="请输入内容"  >
            <el-button slot="prepend" icon="el-icon-search"></el-button>
          </el-input>
          <div class="t_choose_btn_box" v-if="fxtype==1">
            <div class="t_choose_type" @click="changetype(2)">
              <img src="../../../static/img/qz.png" alt="">
              按群组选
            </div>
            <div  class="t_choose_type" @click="changetype(4)">
              <img src="../../../static/img/bq.png" alt="">
              按标签选
            </div>
          </div>
		   <!-- 分类标题 -->
		   <div class="t_all_type_title" v-if="fxtype!=1">
            <i class="el-icon-arrow-left t_back_tab" @click="backtab"></i>  {{ fxtypetitle }}
          </div>

          <div class="t_fx_all">
			<!-- 分类列表 -->
            <div v-if="fxtype==2||fxtype==4">
              <div class="t_type_list_item" v-for="(item,index) in fx_type_list" :key="index" @click="getdetpeo(item)">
                <div>
                  <span style="margin-right: 20px;">{{ item.title }}</span><span style="color: #6C6C6C;">（{{item.num}}）</span>
                </div>
                <div style="color: #5596FF;">成员</div>
              </div>
            </div>
            <div v-if="searchallpeo==''">
              <!-- 全部成员 -->
              <div class="t_fx_item" v-if="fxtype==1" v-for="(item,index) in moneyform.dislist" :key="index">
                <el-checkbox v-model="item.ischecked" @change="changechoose($event,item)" style="margin-right: 10px;" ></el-checkbox>
                {{  item.name}}
              </div>
              <!-- 分组成员 -->
              <div class="t_fx_item" v-if="fxtype==3" >
                <el-checkbox v-model="allfzpeocheck" @change="changechoose($event,'全选')" style="margin-right: 10px;" ></el-checkbox>
                全选
              </div>
              <div class="t_fx_item" v-if="fxtype==3" v-for="(item,index) in fenzupeo" :key="index">
                <el-checkbox v-model="item.ischecked" @change="changechoose($event,item)" style="margin-right: 10px;" ></el-checkbox>
                {{  item.name}}
              </div>
              <!-- 标签成员 -->
              <div class="t_fx_item" v-if="fxtype==5" >
                <el-checkbox v-model="alltagpeocheck" @change="changechoose($event,'全选')" style="margin-right: 10px;" ></el-checkbox>
                全选
              </div>
              <div class="t_fx_item" v-if="fxtype==5" v-for="(item,index) in fentagpeo" :key="index">
                <el-checkbox v-model="item.ischecked" @change="changechoose($event,item)" style="margin-right: 10px;" ></el-checkbox>
                {{  item.name}}
              </div>
            </div>
            <div v-else>
              <!-- 筛选成员 -->
              <div class="t_fx_item"  v-for="(item,index) in shaipeolist" :key="index">
                <el-checkbox v-model="item.ischecked" @change="changechoose($event,item)" style="margin-right: 10px;" ></el-checkbox>
                {{  item.name}}
              </div>
            </div>
            <!-- <div class="t_fx_item"  v-for="(item,index) in moneyform.dislist" :key="index">
              <el-checkbox v-model="item.ischecked" @change="changechoose($event,item)" style="margin-right: 10px;" ></el-checkbox>
              {{  item.name}}
            </div> -->
          </div>
        </div>
        <div class="t_fx_tab" >
          <div>已选择（{{ids_t.length}}）</div>
          <el-input @input="shaitag" v-model="searchhavepeo" style="margin-top: 10px;margin-bottom: 10px;" size="small" placeholder="请输入内容"  >
            <el-button slot="prepend" icon="el-icon-search"></el-button>
          </el-input>
          <div v-if="searchhavepeo==''" class="t_fx_all">
            <el-tag
              class="t_choose_tag"
              v-for="(item,index) in ids_t" :key="index"
              closable
              @close="closetag(item)"
              type="info">
              {{fanyi(item)}}
            </el-tag>
          </div>
          <div v-else class="t_fx_all">
            <el-tag
              class="t_choose_tag"
              v-for="(item,index) in ids_t_s" :key="index"
              closable
              @close="closetag(item)"
              type="info">
              {{fanyi(item)}}
            </el-tag>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="info" round @click="isshowfxs = false">取 消</el-button>
        <el-button type="danger" round @click="updatefx">确 定</el-button>
      </span>
    </el-dialog>
	</div>
</template>

<script>
  import _ from 'lodash';
	import {
		provinceAndCityDataPlus,provinceAndCityData,
		CodeToText,
		TextToCode
	} from 'element-china-area-data'
	import UploadExcelComponent from "@/components/UploadExcel/index.vue";
	import E from 'wangeditor'
	import axios from 'axios'
	import top from '@/components/top.vue'
	import left from '@/components/left.vue'
	import foot from '@/components/foot.vue'
  import dizhi from '@/views/yonghuyunying/zujian/dizhi.vue'
  import chuantu from "../zujian/chuantu.vue";
  import chuantu2 from "../zujian/chuantu2.vue";
  import zdzd from "./zdzd.vue";

	export default {
		components: {
			"left": left,
			"top": top,
			"foot": foot,
			UploadExcelComponent,
      dizhi,chuantu,zdzd,chuantu2
		},

		name: 'addShop',
		data() {
			return {
        yugulog:false,
        jiesuanlog:false,
        chuantushow:false,
				morenyongjin: "",
				child_shop_id: "",
				zidingyixuanzelog: false,
				shoplist: "",
				zidingyiradio: "1",
				zidingyilog: false,
				bianjiyongjinlog: false,
				bianjiyongjinlist: "",
				taglog: false,
				taglist: ['类型1', '类型2'],
				inputVisible: false,
				inputValue: '',

				mingan: {
					city: "",
					citys: [],
					fixcitys: []
				},
				randomnum: "",
				jingdongrandom: "",
				search: "",
				msg: "hello",
				log: false,
				loading: false,
				loadingshop: true,

				active: false,
				first_recharge: false,
				recharge_amount: false,
				first_rules: {
					rules: "",
					active_commission: 0,
					first_recharge_one: 0,
					first_recharge_one_commission: 0,
					first_recharge_two: 0,
					first_recharge_two_commission: 0,
					recharge_amount_one: 0,
					recharge_amount_one_commission: 0,
					recharge_amount_two: 0,
					recharge_amount_two_commission: 0
				},
				rebate_rule: "",

				typelist: {},
				citylist: provinceAndCityData,
				rules: {
					operator: [{
						required: true,
						message: '必选',
						trigger: 'change'
					}],
					name: [{
						required: true,
						message: '必填',
						trigger: 'blur'
					}],
          sign_type: [{
            required: true,
            message: '必填',
            trigger: 'change'
          }],
					proid: [{
						required: true,
						message: '必填',
						trigger: 'blur'
					}],
					title: [{
						required: true,
						message: '必填',
						trigger: 'blur'
					}],
					sku: [{
						required: true,
						message: '必填',
						trigger: 'blur'
					}],
					city: [{
						required: true,
						message: '请选择活动区域',
						trigger: 'change'
					}],
					real_name_type: [{
						required: true,
						message: '请输入',
						trigger: 'change'
					}],
					randomnum: [{
						required: true,
						message: '请输入抓单码',
						trigger: 'change'
					}],
					// title: [{ required: true, message: '必填', trigger: 'change' }],
					is_need_photo: [{
						required: true,
						message: '必选',
						trigger: 'change'
					}],
					img: [{
						required: true,
						message: '必选',
						trigger: 'change'
					}],
					edit: [{
						required: true,
						message: '必填',
						trigger: 'change'
					}],
					visible: [{
						required: true,
						message: '必选',
						trigger: 'change'
					}],
					commission: [{
						required: true,
						message: '必填',
						trigger: 'change'
					}],
				},
				form: {
					produce_address: "",
					operator: 10099,
					name: "",
					sku: "",
					plan_type_id: "",
					province: "",
					city: [],
					real_name_type: '0',
					produce_remark: "",
					status: "",
					comname: "",
					min_age: 18,
					max_purchase: 5,

					haochinum: 1,
					haochival: 1,

					address_province: "",
					address_city: "",
					address_district: "",
					commission_rule: "",
          commission_notes:""
				},
				shopform: {
          sign_type:1,
          expect_income:"",
					product_id: "",
					title: "",
					status: 0,
					parent_id: "",
					selling_point: "",
					commission_rule: "",
          estimated_income:"",
          commission_notes:"",
					is_need_photo: '0',
					description: "",
					pdd_description: "",
					image1: "",
					imageUrl: '',
					imageUrl2: '',
					details: {
						yuezu: "",
						liuliang: "",
						yuyin: "",
						quanyi: "",
						taocan: ""
					},
					split_number:"",
          			share_img:"",
					  auto_transfer:'',
					  auto_transfer_sources:[],
					  auto_transfer_pages:[],
            is_force_recharge:0,
            commission_rule_change_at:"",
            change_commission_notes:"",
            commission_notes_change_at:"",
            expect_income_change_at:"",
            change_commission_rule:"",
            change_expect_income:"",
            expect_income_new:"",
            fanli_start:"",
            fanli_end:""
				},
        jiesuanlog2:false,
				split_list:[],
				moneyform: {
					order_page_id: "",
					visible: '1',
					commission: 0,
					child_shop_ids: [],
					dislist: "",
					money: "",
					list: "",
					tika_cost: "",
					is_notice: true
				},
				rules2: {
					operator: [{
						required: true,
						message: '请选择活动区域',
						trigger: 'change'
					}],
					name: [{
						required: true,
						message: '必填',
						trigger: 'blur'
					}],
					sku: [{
						required: true,
						message: '必填',
						trigger: 'blur'
					}],
					city: [{
						required: true,
						message: '请选择活动区域',
						trigger: 'change'
					}],
					real_name_type: [{
						required: true,
						message: '请输入',
						trigger: 'change'
					}],
					randomnum: [{
						required: true,
						message: '请输入抓单码',
						trigger: 'change'
					}],
					// title: [{ required: true, message: '必填', trigger: 'change' }],
					is_need_photo: [{
						required: true,
						message: '必选',
						trigger: 'change'
					}],
					img: [{
						required: true,
						message: '必选',
						trigger: 'change'
					}],
					edit: [{
						required: true,
						message: '必填',
						trigger: 'change'
					}],
					visible: [{
						required: true,
						message: '必选',
						trigger: 'change'
					}],
					// commission: [{ required: true, message: '必选', trigger: 'change' }],
				},
				kejian: false,
				sub1: true,
				sub2: true,
				sub3: true,
				sub4: true,
				showmoney: false,
				sanlist: [
     //      {
					// 	name: "中国联通",
					// 	id: 10000
					// },
					// {
					// 	name: "中国移动",
					// 	id: 10086
					// },
					// {
					// 	name: "中国电信",
					// 	id: 10010
					// },
					{name:"中国广电",id:10099},
					// {
					// 	name: "虚拟运营商",
					// 	id: 11111
					// }
				],
				stat: "",
				randomvalue: "",
				randomone: false,
				randomlog: false,
				shop_id: "",
				prolists: {},
				proid: "",
				allshow: false,
				kucunnum: "",
				kucun: "9999",
				kucuninp: false,
				kucunwarm: "",
				shop: "",
				cishu:0,

        shop_id:"",
        tit:"增加佣金规则",
        dingshilog:false,
        dingshi:"",
        dingshidata:"",

        genjuguize:[],
        guizelistlog:false,
        tianjiadailishanglog:false,
        xin:{
          order_page_id: "",
          child_shop_id: "",
          config_id: ""
        },
         activeName:"first",
         allshow2:false,
         guishudi_all:"",
         cd_type_radio:4,
         cd_number:"0",

         provinceData: provinceAndCityData,
         cityData: [],
         provinceText: '',
         cityText: '',
		 //  指定分销商弹窗
         isshowfxs:false,
         ids_t:[],
		 fxtype:1,//1全部，2选组，3组成员，4选标签，5标签成员
         fxtypetitle:'',
         fx_type_list:[],
         fenzupeo:[],
         fentagpeo:[],
         searchhavepeo:'',
         ids_t_s:[],
         searchallpeo:'',
         shaipeolist:[],
         allfzpeocheck:false,
         alltagpeocheck:false,
         fromtype:null,
		 isxn:false,

     fanli_money_array:[]
			}

		},
		created() {
			//权限问题
			var user = JSON.parse(localStorage.getItem('USER'));
			this.shop = user.id

			//获取分销商
			this.getdislist()
			// this.getmoneylist2()
			//获取类型
			this.getproductstype();

			this.getpros()

			//获取返利规则
			// this.getfanli()

			this.getshopdetail();
			axios.get('/api/gth/user/shop')
				.then(response => {
					if (response.data.msg.code == 0) {
						this.shop_id = response.data.data.shop_id

            // if(this.shop_id == 50481 || this.shop_id == 304676){
            //   if(this.$route.query.allshow){
            //     this.$router.push('/productionDelivery/addshop2?allshow='+this.$route.query.allshow+'&id='+this.$route.query.id)
            //   }else{
            //     this.$router.push('/productionDelivery/addshop2')
            //   }
            // }

					} else {
						if (response.data.msg.code == 50401) {
							that.$router.push({
								path: "/login"
							});
							return false
						}
						that.$message.error(response.data.msg.info);
					}
				})
			//发布完整产品商品
			if (this.$route.query.allshow == 'allshow') {
				this.allshow = true
			}
		},
		mounted() {
      this.chuantushow = true
      this.citylist.forEach(item=>{
        if(item.label == '北京市'){
          item.children.forEach(item=>{
            item.label = '北京市'
          })
        }
        if(item.label == '上海市'){
          item.children.forEach(item=>{
            item.label = '上海市'
          })
        }
        if(item.label == '重庆市'){
          item.children.forEach(item=>{
            item.label = '重庆市'
          })
        }
        if(item.label == '天津市'){
          item.children.forEach(item=>{
            item.label = '天津市'
          })
        }
      })

			var that = this
			var editor = new E('#editor');
			editor.customConfig.uploadImgServer = '/upload'
			editor.customConfig.showLinkImg = false
			editor.customConfig.onchange = function(html) {
				that.shopform.description = html
			}
			editor.customConfig.customUploadImg = function(files, insert) {

				var formData = new FormData();
				formData.append("pic", files[0]);
				axios.post('/api/plan-market/order-page/upload-pic', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
							insert(response.data.data)

						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			}
			editor.create();
			//其它备注
			var editorE = new E('#editorE');
			editorE.customConfig.uploadImgServer = '/upload'
			editorE.customConfig.showLinkImg = false
			editorE.customConfig.onchange = function(html) {
				that.shopform.pdd_description = html
			}
			editorE.customConfig.customUploadImg = function(files, insert) {
				var formData = new FormData();
				formData.append("pic", files[0]);
				axios.post('/api/plan-market/order-page/upload-pic', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
							insert(response.data.data)

						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			}
			editorE.create();

			//套餐详细信息
			var editorE2 = new E('#editorE2');
			editorE2.customConfig.uploadImgServer = '/upload'
			editorE2.customConfig.showLinkImg = false
			editorE2.customConfig.onchange = function(html) {
				that.shopform.package_text = html
			}
			editorE2.customConfig.customUploadImg = function(files, insert) {
				console.log(files)
				var that = this;
				var formData = new FormData();
				formData.append("pic", files[0]);
				axios.post('/api/plan-market/order-page/upload-pic', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
							insert(response.data.data)
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			}
			editorE2.create();

			// var that = this;
			// axios.get('/api/plan-market/order-page?order_page_id='+this.$route.query.id)
			// 	.then(response => {
			// 		if(response.data.msg.code == 0){
			// 			var arr = ""
			// 			for(var i in response.data.data.selling_point){
			// 				arr = arr + response.data.data.selling_point[i]+'，'
			// 			}
			// 			response.data.data.selling_point = arr.substr(0, arr.length - 1);

			// 			that.shopform = response.data.data
			//             that.randomnum = response.data.data.fetch_code
			//             that.jingdongrandom = response.data.data.fetch_code2
			// 			editor.txt.html(this.shopform.description)

			// //随机生成10位数
			axios.get('/api/sys/str-random')
				.then(response => {
					if (response.data.msg.code == 0) {
						this.randomnum = response.data.data
					} else {
						this.$message.error(response.data.msg.info);
					}

				})
			// 		}else{
			// 			that.$message.error(response.data.msg.info);
			// 		}
			// 	})
		},
		methods: {
      timechange:function(){
        if(this.times != null){
        	this.shopform.fanli_start = this.times[0];
        	this.shopform.fanli_end = this.times[1];
        }else{
          this.shopform.fanli_start = ''
          this.shopform.fanli_end = ''
        }
      },
      //添加月份
      changefanli_money_array:function(){
        this.fanli_money_array.push(0)
      },
      getimg:function(img){
        this.shopform.image1 = img
      },
      getimg2:function(img){
        this.shopform.share_img = img
      },
      xuanzhongde:function(item){
        this.shopform.guishudi = item.zi
        this.shopform.guishudi_code = item.shu
        // this.all.province = item
      },
      // handleChangeProvince(value) {
      //       this.cityData = []
      //       this.cityText = ''
      //       const province = CodeToText[value]
      //       if (province === '北京市' || province === '天津市' || province === '上海市' || province === '重庆市' ||
      //         province === '香港特别行政区' || province === '澳门特别行政区') {
      //         const city = { value: value, label: province }
      //         this.cityData.push(city)
      //       } else {
      //         const childList = this.provinceData.find(i => i.value === value).children
      //         this.cityData.push(...childList)
      //       }
      //       console.log(this.provinceText,this.cityText)

      // },
      // guishudi:function(val){
      //   if(val[0] == '全部'){
      //     this.shopform.guishudi_province = ''
      //   }else{
      //     this.shopform.guishudi_province = CodeToText[val[0]]
      //   }
      //   if(val[1] == '全部'){
      //     this.shopform.guishudi_city = ''
      //   }else{
      //     this.shopform.guishudi_city = CodeToText[val[1]]
      //   }
      // },
      guanlishan:function(item){
         this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            console.log(item)
            //管理删除
            axios.post('/api/plan-market/order-page/commissions/update',{
              order_page_id: this.moneyform.order_page_id,
              child_shop_id: item.child_shop_id,
              config_id: 0
            })
            	.then(response => {
            		if(response.data.msg.code == 0){
                  this.$message({
                    message: '删除成功！',
                    type: 'success'
                  });
                  this.getmoneylist()
                  //添加后重新获取一下列表
                  axios.get('/api/plan-market/order-page/commissions?_page_size=2000&order_page_id='+this.moneyform.order_page_id+'&config_id='+this.xin.config_id)
                  	.then(response => {
                  		if(response.data.msg.code == 0){
                        this.genjuguize = response.data.data.data

                  		}else{
                  			this.$message.error(response.data.msg.info);
                  		}
                  	})

                  this.tianjiadailishanglog = false
            		}else{
            			this.$message.error(response.data.msg.info);
            		}
            	})
          })

      },
      tianjiadailishang:function(){
        this.tianjiadailishanglog = true
      },
      tianjiadailishanggo:function(){
        axios.post('/api/plan-market/order-page/commissions/update',this.xin)
        	.then(response => {
        		if(response.data.msg.code == 0){
              this.$message({
                message: '保存成功！',
                type: 'success'
              });
              this.getmoneylist()
              //添加后重新获取一下列表
              axios.get('/api/plan-market/order-page/commissions?_page_size=2000&order_page_id='+this.moneyform.order_page_id+'&config_id='+this.xin.config_id)
              	.then(response => {
              		if(response.data.msg.code == 0){
                    this.genjuguize = response.data.data.data

              		}else{
              			this.$message.error(response.data.msg.info);
              		}
              	})

              this.tianjiadailishanglog = false
        		}else{
        			this.$message.error(response.data.msg.info);
        		}
        	})
      },
      guanli:function(item){
        console.log(item)
        this.xin.order_page_id = this.moneyform.order_page_id
        if(item.type == 1){
          this.xin.config_id = 0
        }else{
          this.xin.config_id = item.id
        }
        this.xin.child_shop_id = ""

        //获取列表genjuguize
        // /api/plan-market/order-page/commissions?_page_size=2000&order_page_id=613626&name=
        axios.get('/api/plan-market/order-page/commissions?_page_size=2000&order_page_id='+this.moneyform.order_page_id+'&config_id='+this.xin.config_id)
        	.then(response => {
        		if(response.data.msg.code == 0){
              this.genjuguize = response.data.data.data
              this.guizelistlog = true
        		}else{
        			this.$message.error(response.data.msg.info);
        		}
        	})

      },


      change_active:function(){
        if(!this.active){
          this.first_rules.active_commission = 0
        }
      },
      change_first_recharge:function(){
        if(!this.first_recharge){
          this.first_rules.first_recharge_one = 0
          this.first_rules.first_recharge_two = 0
          this.first_rules.first_recharge_one_commission = 0
          this.first_rules.first_recharge_two_commission = 0
        }
      },
      change_recharge_amount:function(){
        if(!this.recharge_amount){
          this.first_rules.recharge_amount_one = 0
          this.first_rules.recharge_amount_two = 0
          this.first_rules.recharge_amount_one_commission = 0
          this.first_rules.recharge_amount_two_commission = 0
        }
      },

      savefanli2ok:function(){
        console.log(this.first_rules)
          this.$set(this.first_rules,'start_at',this.dingshi)

          axios.post('/api/plan-market/commission/page/configs/cron',this.dingshidata)
          	.then(response => {
                if(response.data.msg.code == 0){
                    this.loadingcon = false
                    this.getfanli()
                    this.$message.success("保存成功！");
                    this.bianjiyongjinlog = false
                    this.dingshilog = false
                }else{
                    this.$message.error(response.data.msg.info);
                }
          	})

          // axios.post('/api/plan-market/commission/page/configs',this.dingshidata)
          // 	.then(response => {
          //       if(response.data.msg.code == 0){
          //           this.loadingcon = false
          //           this.getfanli()
          //           this.$message.success("保存成功！");
          //           this.bianjiyongjinlog = false
          //           this.dingshilog = false
          //       }else{
          //           this.$message.error(response.data.msg.info);
          //       }
          // 	})
      },
      savefanli2:function(){
        var that = this
        var datas = {}
        datas['page_id'] = this.$route.query.id
        if(this.bianjiyongjinlist.length == 0 || this.first_rules.type == 1){
            datas['type'] = 1
        }else{
            datas['type'] = 3
        }
        datas['rules'] = this.first_rules

        this.dingshidata = datas
        this.dingshilog = true
        this.dingshi = ''

      },

			jiancha:function(){
        console.log(this.shopform)
				this.loading = true
				if(this.split_list.length != 0){
					this.checksku(this.split_list[0].sku)
				}else{
					this.shopsave()
					this.loading = false
				}
			},
			checksku:function(sku){
				axios.post('/api/plan-market/shop/sku/check',{sku:sku})
					.then(response => {
						if (response.data.msg.code == 0) {
							this.cishu++
							if(this.cishu == this.split_list.length){
								this.shopsave()
								this.cishu = 0
								this.loading = false
							}else{
								this.checksku(this.split_list[this.cishu].sku)
							}
						} else {
							this.cishu = 0
							this.loading = false
							this.$message.error(sku + response.data.msg.info);
							return false
						}
					})
			},
			changenumber:function(val){
				let v = val - this.split_list.length
				if(v > 0){
					for(let i = 0; i < v; i++){
						// 当前商品id  拆单商品sku 第几个拆单  是否检测发货1检测0不 later是多少小时后拆单 1=1小时
						this.split_list.push(
							{
								page_id:"",
								sku:"",
								split_number:"",
								check_deliver:"",
								later:""
							}
						)
					}
				}else{
					this.split_list.length = val
				}
			},
			dayu0: function() {
				if (this.moneyform.tika_cost < 0) {
					this.moneyform.tika_cost = 0
				}
			},
			//获取分销商和佣金
			getmoneylist2: function() {
				var that = this;
				axios.get('/api/plan-market/order-page/commissions?_page_size=10000&order_page_id=' + this.$route.query.id)
					.then(response => {
						if (response.data.msg.code == 0) {
							that.moneylist = response.data.data.data
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
			//搜索功能
			searchgo: function() {
				this.loading = true
				this.getmoneylist();
			},
			//保存返利规则
			savefanli: function() {
				var that = this
				var datas = {}
				datas['page_id'] = this.moneyform.order_page_id
				if (this.bianjiyongjinlist.length == 0 || this.first_rules.type == 1) {
					datas['type'] = 1
				} else {
					datas['type'] = 3
				}
				datas['rules'] = this.first_rules

				axios.post('/api/plan-market/commission/page/configs', datas)
					.then(response => {
						if (response.data.msg.code == 0) {
							that.loadingcon = false
							that.getfanli()
							that.$message.success("保存返利成功！");
							that.bianjiyongjinlog = false
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
			bianjiyongjinlogshow:function(){
			  this.active = false
			  this.first_recharge = false
			  this.recharge_amount = false
        this.first_rules = {
									name: "",
									active_commission: 0,
									first_recharge_one: 0,
									first_recharge_one_commission: 0,
									first_recharge_two: 0,
									first_recharge_two_commission: 0,
									recharge_amount_one: 0,
									recharge_amount_one_commission: 0,
									recharge_amount_two: 0,
									recharge_amount_two_commission: 0
				}

			  this.tit = '新增佣金规则'
			  if(this.bianjiyongjinlist.length == 0){
			      console.log(this.first_rules)
			      this.first_rules.name = '默认规则'
			  }
			  this.bianjiyongjinlog = true
			},
			zidingyiradiook: function() {
				var that = this;
				var formData = new FormData();
				formData.append("order_page_id", this.moneyform.order_page_id);
				formData.append("child_shop_id", this.child_shop_id);
				formData.append("config_id", this.zidingyiradio);

				axios.post('/api/plan-market/order-page/commissions/update', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
							that.$message({
								message: '保存成功！',
								type: 'success'
							});
							that.searchgo()
							that.zidingyilog = false
							that.zidingyixuanzelog = false
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
			zidingyibianji: function(id, child_shop_id) {
				this.child_shop_id = child_shop_id
				this.zidingyiradio = id
				this.zidingyixuanzelog = true
			},
			//指定规则
			zhidingguize: function() {
				this.zidingyilog = true
			},
			//关闭添加佣金规则弹框
			bianliyongjinlogclose: function() {
				this.first_rules = {
					name: "",
					active_commission: 0,
					first_recharge_one: 0,
					first_recharge_one_commission: 0,
					first_recharge_two: 0,
					first_recharge_two_commission: 0,
					recharge_amount_one: 0,
					recharge_amount_one_commission: 0,
					recharge_amount_two: 0,
					recharge_amount_two_commission: 0
				}
				this.bianjiyongjinlog = false
			},
			//输入时的选中
			inputchoose: function() {
				if (this.first_rules.active_commission != 0 && this.first_rules.active_commission != '') {
					this.active = true
				}

				if (this.first_rules.first_recharge_one != 0 && this.first_rules.first_recharge_one != '') {
					this.first_recharge = true
				}
				if (this.first_rules.first_recharge_one_commission != 0 && this.first_rules.first_recharge_one_commission != '') {
					this.first_recharge = true
				}
				if (this.first_rules.first_recharge_two != 0 && this.first_rules.first_recharge_two != '') {
					this.first_recharge = true
				}
				if (this.first_rules.first_recharge_two_commission != 0 && this.first_rules.first_recharge_two_commission != '') {
					this.first_recharge = true
				}

				if (this.first_rules.recharge_amount_one != 0 && this.first_rules.recharge_amount_one != '') {
					this.recharge_amount = true
				}
				if (this.first_rules.recharge_amount_one_commission != 0 && this.first_rules.recharge_amount_one_commission != '') {
					this.recharge_amount = true
				}
				if (this.first_rules.recharge_amount_two != 0 && this.first_rules.recharge_amount_two != '') {
					this.recharge_amount = true
				}
				if (this.first_rules.recharge_amount_two_commission != 0 && this.first_rules.recharge_amount_two_commission != '') {
					this.recharge_amount = true
				}
			},
			getfanli: function() {
				//先获取一下商品返利
				var that = this
				axios.get('/api/plan-market/commission/page/configs?page_id=' + this.moneyform.order_page_id)
					.then(response => {
						if (response.data.msg.code == 0) {
							if (response.data.data.rules != null) {
								that.bianjiyongjinlist = response.data.data.rules
								for (var i = 0; i < that.bianjiyongjinlist.length; i++) {
									if (that.bianjiyongjinlist[i].type == 1) {
										that.morenyongjin = that.bianjiyongjinlist[i]
										console.log(that.morenyongjin)
									}

								}
								that.inputchoose()
								that.loadingcon = false

								that.first_rules = {
									name: "",
									active_commission: 0,
									first_recharge_one: 0,
									first_recharge_one_commission: 0,
									first_recharge_two: 0,
									first_recharge_two_commission: 0,
									recharge_amount_one: 0,
									recharge_amount_one_commission: 0,
									recharge_amount_two: 0,
									recharge_amount_two_commission: 0
								}
							}
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
			//编辑佣金选择自动添加入内容
			bianjiyongjinchange: function(d) {
				this.first_rules = d
				this.inputchoose()
				this.bianjiyongjinlog = true
			},
			//库存选择与显示
			changekucun: function() {
				if (this.kucun == 1) {
					this.kucuninp = true
				} else {
					this.kucuninp = false
				}
			},
			inputchoose: function() {
				if (this.first_rules.active_commission != 0 && this.first_rules.active_commission != '') {
					this.active = true
				}

				if (this.first_rules.first_recharge_one != 0 && this.first_rules.first_recharge_one != '') {
					this.first_recharge = true
				}
				if (this.first_rules.first_recharge_one_commission != 0 && this.first_rules.first_recharge_one_commission != '') {
					this.first_recharge = true
				}
				if (this.first_rules.first_recharge_two != 0 && this.first_rules.first_recharge_two != '') {
					this.first_recharge = true
				}
				if (this.first_rules.first_recharge_two_commission != 0 && this.first_rules.first_recharge_two_commission != '') {
					this.first_recharge = true
				}

				if (this.first_rules.recharge_amount_one != 0 && this.first_rules.recharge_amount_one != '') {
					this.recharge_amount = true
				}
				if (this.first_rules.recharge_amount_one_commission != 0 && this.first_rules.recharge_amount_one_commission != '') {
					this.recharge_amount = true
				}
				if (this.first_rules.recharge_amount_two != 0 && this.first_rules.recharge_amount_two != '') {
					this.recharge_amount = true
				}
				if (this.first_rules.recharge_amount_two_commission != 0 && this.first_rules.recharge_amount_two_commission != '') {
					this.recharge_amount = true
				}
			},
			//保存返利
			getfanli: function() {
				//先获取一下商品返利
				var that = this
				axios.get('/api/plan-market/commission/page/configs?page_id=' + this.moneyform.order_page_id)
					.then(response => {
						if (response.data.msg.code == 0) {
							if (response.data.data.rules != null) {
								that.bianjiyongjinlist = response.data.data.rules
								for (var i = 0; i < that.bianjiyongjinlist.length; i++) {
									if (that.bianjiyongjinlist[i].type == 1) {
										that.morenyongjin = that.bianjiyongjinlist[i]
									}

								}
								that.inputchoose()
								that.loadingcon = false

								that.first_rules = {
									name: "",
									active_commission: 0,
									first_recharge_one: 0,
									first_recharge_one_commission: 0,
									first_recharge_two: 0,
									first_recharge_two_commission: 0,
									recharge_amount_one: 0,
									recharge_amount_one_commission: 0,
									recharge_amount_two: 0,
									recharge_amount_two_commission: 0
								}
							}
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
			//编辑佣金选择自动添加入内容
			bianjiyongjinchange:async function(d){

			    await axios.get('/api/plan-market/commission/page/configs/cron/get?config_id='+d.id)
			  	.then(response => {
			        if(response.data.msg.code == 0){
			          this.active = false
			          this.first_recharge = false
			          this.recharge_amount = false
			          this.first_rules = JSON.parse(JSON.stringify(d))
			          if(this.first_rules.active_commission > 0 ){ this.active = true}
			          if(this.first_rules.first_recharge_one > 0 || this.first_rules.first_recharge_two > 0 || this.first_rules.first_recharge_one_commission > 0 || this.first_rules.first_recharge_two_commission > 0){ this.first_recharge = true}
			          if(this.first_rules.recharge_amount_one > 0 || this.first_rules.recharge_amount_two > 0 || this.first_rules.recharge_amount_one_commission > 0 || this.first_rules.recharge_amount_two_commission > 0){ this.recharge_amount = true}


			          if(response.data.data != null && response.data.data != ''){
			            this.$set(this.first_rules,'start_at',response.data.data.start_at)
			            this.first_rules2 = response.data.data
			          }

			          this.tit = '修改佣金规则'

			          this.inputchoose()
			          this.bianjiyongjinlog = true

			        }else{
			            this.$message.error(response.data.msg.info);
			        }
			  	})


			},


			//获取全部基础产品
			getpros: function() {
				var that = this
				axios.get('/api/gth/products/list?page_size=1000')
					.then(response => {
						if (response.data.msg.code == 0) {
							that.prolists = response.data.data.data

							//发布完整商品使用
							if (this.$route.query.allshow == 'allshow') {
								that.proid = this.$route.query.id
								that.proid = parseInt(that.proid)
							}

							that.loadingshop = false
						} else {
							that.$message.error(response.data.msg.info);
						}
					})

			},
			//自定义抓单码唯一性
			randomnumwrite: function() {
				var that = this
				axios.get('/api/plan-market/order-page/fetch-code/isexist?fetch_code=' + this.randomvalue)
					.then(response => {
						if (response.data.msg.code == 0) {
							that.randomone = false
						} else {
							that.randomone = true
						}
					})
			},
			//自定义抓单码点击确认
			randomgo: function() {
				this.randomnum = this.randomvalue
				this.randomlog = false
			},
			//获取商品品详情
			getshopdetail: function() {

			},
			//修改佣金时执行全部佣金赋值并保存后重新获取一下列表和佣金
			fixallmoney: function() {
				var that = this;
				var formData = new FormData();
				formData.append("order_page_id", this.moneyform.order_page_id);
				formData.append("visible", this.moneyform.visible);
				formData.append("commission", this.moneyform.commission);
				formData.append("child_shop_ids", this.moneyform.child_shop_ids);

				axios.post('/api/gth/order-page/visible', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
							that.getmoneylist();
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
			//个性化编辑佣金
			fixmoney: function(id) {
				this.$prompt('请输入金额', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
				}).then(response => {
					var that = this;
					var formData = new FormData();
					formData.append("order_page_id", that.moneyform.order_page_id);
					formData.append("child_shop_id", id);
					formData.append("commission", response.value);

					axios.post('/api/plan-market/order-page/commissions/update', formData)
						.then(response => {
							if (response.data.msg.code == 0) {
								this.getmoneylist();
								that.$message({
									message: '保存成功！',
									type: 'success'
								});
							} else {
								that.$message.error(response.data.msg.info);
							}
						})
				})
			},

			//获取分销商和佣金
			getmoneylist: function() {
				var that = this;
				axios.get('/api/plan-market/order-page/commissions?_page_size=10000&order_page_id=' + this.moneyform.order_page_id +
						'&name=' + this.search)
					.then(response => {
						if (response.data.msg.code == 0) {

							that.shoplist = response.data.data.data
							that.loading = false
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},

			chakan: function() {
				console.log(this.moneyform.child_shop_ids)
			},
			//产品名验证唯一性
			nijiushiwodeweiyi1: function() {
				var that = this;
				axios.get('/api/plan-market/product/name/isexist?name=' + that.form.name)
					.then(response => {
						if (response.data.msg.code == 0) {
							this.sub1 = true
						} else {
							this.sub1 = false
							that.$message.error(response.data.msg.info);
						}
					})
			},
			//产品编号验证唯一性
			nijiushiwodeweiyi2: function() {
				var that = this;
				axios.get('/api/plan-market/product/sku/isexist?sku=' + this.form.sku)
					.then(response => {
						if (response.data.msg.code == 0) {
							this.sub2 = true
						} else {
							this.sub2 = false
							that.$message.error(response.data.msg.info);
						}
					})
			},

			nijiushiwodeweiyi3: _.debounce(function() {
				var that = this;
				axios.get('/api/plan-market/order-page/name/isexist?title=' + this.shopform.title)
					.then(response => {
						if (response.data.msg.code == 0) {
							this.sub3 = true
						} else {
							this.sub3 = false
							that.$message.error(response.data.msg.info);
						}
					})
			}, 500),

			//京东唯一性
			nijiushiwodeweiyi4: function() {
				this.jingdongrandom = this.jingdongrandom.trim()
				if (this.jingdongrandom == "") {
					this.sub4 = true
				} else {
					var that = this;
					axios.get('/api/plan-market/order-page/fetch-code?fetch_code2=' + this.jingdongrandom)
						.then(response => {
							if (response.data.msg.code == 0) {
								this.sub4 = true
							} else {
								this.sub4 = false
								that.$message.error(response.data.msg.info);
							}
						})
				}

			},
			//身份证审核
			cardid: function() {
				this.moneyform.child_shop_ids = [];
				if (this.moneyform.visible == 3 || this.moneyform.visible == 4) {
					this.kejian = true
				}
				if (this.moneyform.visible == 1 || this.moneyform.visible == 2) {
					this.kejian = false
				}
			},
			//获取全部分销商
			getdislist: function() {
				var that = this;
				axios.get('/api/gth/partner/list?page_size=10000')
					.then(response => {
						if (response.data.msg.code == 0) {
							that.moneyform.dislist = response.data.data.data
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},

			//保存商品
			shopsave: function(stat) {

        if(this.shop_id == 304676 || this.shop_id == 50481){
          if(!this.shopform.expect_income_new){
            this.$message.error("承接佣金规则必填");
            return false
          }
          if(!this.shopform.commission_notes){
            this.$message.error("佣金结算规则（内部）");
            return false
          }
        }

				if (this.proid == '') {
					this.$message.error("请选择商品");
					return false
				}
				if (this.shopform.title == '') {
					this.$message.error("请输入商品名称");
					return false
				}
				if (this.shopform.description == '') {
					this.$message.error("请输入商品详情");
					return false
				}
				if (this.sub4 == false) {
					return false
				}
				if (this.jingdongrandom == "" || this.jingdongrandom == null) {

				} else {
					if (this.jingdongrandom.length != 3) {
						this.$message.error("京东抓单码必须三位或者不填写");
						return false
					}
				}
				var that = this;
				this.stat = stat

        // if(this.provinceText){
        //   this.shopform.guishudi_province = CodeToText[this.provinceText]
        // }else{
        //   this.shopform.guishudi_province = ""
        // }
        // if(this.cityText){
        //   this.shopform.guishudi_city = CodeToText[this.cityText]
        // }else{
        //   this.shopform.guishudi_city = ""
        // }
				var formData = {
					title: this.shopform.title,
					product_id: this.proid,
					selling_point: this.shopform.selling_point,
					commission_rule: this.shopform.commission_rule,
          commission_notes: this.shopform.commission_notes,
          estimated_income: this.shopform.estimated_income,

					is_need_photo: this.shopform.is_need_photo,
					description: this.shopform.description,
					pdd_description: this.shopform.pdd_description,
					image1: this.shopform.image1,
					fetch_code: this.randomnum,
					status: 0,
					fetch_code2: this.jingdongrandom,
					details: JSON.stringify(this.shopform.details),
          expect_income: this.shopform.expect_income,
          // guishudi_province: this.shopform.guishudi_province,
          // guishudi_city: this.shopform.guishudi_city,
          guishudi: this.shopform.guishudi,
          guishudi_code: this.shopform.guishudi_code,
          yuezu: this.shopform.yuezu,
          liuliang: this.shopform.liuliang,
          yuyin: this.shopform.yuyin,
          yuezu_time: this.shopform.yuezu_time,
          yuezu_type: this.shopform.yuezu_type,
          yongjin_time: this.shopform.yongjin_time,
          yongjin_type: this.shopform.yongjin_type,
          fanli_time: this.shopform.fanli_time,
          fanli_type: this.shopform.fanli_type,
          share_img: this.shopform.share_img,
		  dx_liuliang:this.shopform.dx_liuliang,
		  package_text:this.shopform.package_text,
		  points:this.shopform.points,
      sign_type:this.shopform.sign_type,

		  fanli_money:this.shopform.fanli_money,
		  is_rebate:this.shopform.is_rebate,
		  auto_transfer:this.shopform.auto_transfer,
		  auto_transfer_sources:this.shopform.auto_transfer_sources,
		  auto_transfer_pages:this.shopform.auto_transfer_pages,
      fanli_money_type:this.shopform.fanli_money_type,
      fanli_money_array:this.fanli_money_array.toString(),
      commission_rule_change_at:this.shopform.commission_rule_change_at,
      change_commission_notes:this.shopform.change_commission_notes,
      commission_notes_change_at:this.shopform.commission_notes_change_at,
      expect_income_change_at:this.shopform.expect_income_change_at,
      change_commission_rule:this.shopform.change_commission_rule,
      change_expect_income:this.shopform.change_expect_income,
      expect_income_new:this.shopform.expect_income_new,
      fanli_start:this.shopform.fanli_start,
      fanli_end:this.shopform.fanli_end
				}

				if (this.isxn == true) {
					formData['is_virtually'] = 1
				} else {
					formData['is_virtually'] = 0
				}


				axios.post('/api/plan-market/order-page/release', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
              this.allshow2 = true
							//添加拆单设置

							if(this.split_list != ''){

								// this.split_list.forEach((item,index)=>{
								// 	if(item.check_deliver == true){
								// 		item.check_deliver = 1
								// 	}else{
								// 		item.check_deliver = 0
								// 	}
								// 	item.page_id = response.data.data.id
								// 	item.split_number = index+1
								// })

                this.split_list.forEach((item,index)=>{
                	if(this.cd_type_radio==3){
                		//按条件拆单
                		item.check_deliver = 2
                		item.later = "0"
                	}else if(this.cd_type_radio==4){
                		//按时间拆单
                		if(item.check_deliver == true){
                			item.check_deliver = 1
                		}else{
                			item.check_deliver = 0
                		}
                	}

                	item.page_id = response.data.data.id
                	item.split_number = index+1
                })

								let datas = {
									data:this.split_list,
									page_id:response.data.data.id
								}
								axios.post('/api/plan-market/split/config2', datas)
									.then(response => {
										if (response.data.msg.code == 0) {

										} else {
											that.$message.error(response.data.msg.info);
											return false
										}
									})
							}


							that.moneyform.order_page_id = response.data.data.id



							//获取分销商列表和佣金
							this.getmoneylist()

							if (this.form.stat == 0) {
								that.$message({
									message: '保存商品成功！',
									type: 'success'
								});

								this.$router.push({
									path: '/productionDelivery'
								})
							} else {
								// that.showmoney = true;
								if(this.allshow){
									this.$router.push({
										path: '/productionDelivery/fixproductmoney',
										query: {
											id: this.moneyform.order_page_id,
											type:1
										}
									})
								}else{
									this.$router.push({
										path: '/productionDelivery/fixproductmoney',
										query: {
											id: this.moneyform.order_page_id,
											type:2
										}
									})
								}

							}
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
			//保存提卡费
			savetikafei: async function() {
				await axios.post('/api/gth/tika/config', {
						page_id: this.moneyform.order_page_id,
						tika_cost: this.moneyform.tika_cost
					})
					.then(response => {
						if (response.data.msg.code == 0) {

						} else {
							that.$message.error(response.data.msg.info);
							return false
						}
					})
			},


			//绑定佣金分销商
			bangding: async function() {
				await this.savetikafei();
				// if(this.moneyform.commission == ""){
				//     this.$message({
				//         message: '请先编辑佣金！',
				//         type: 'success'
				//     });
				//     return false
				// }
				var that = this;
				var formData = new FormData();
				formData.append("order_page_id", this.moneyform.order_page_id);
				formData.append("visible", this.moneyform.visible);
				formData.append("commission", 0);
				formData.append("child_shop_ids", this.moneyform.child_shop_ids);
				formData.append("tika_cost", this.moneyform.tika_cost);
				formData.append("is_notice", this.moneyform.is_notice);

				await axios.post('/api/gth/order-page/visible', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
							axios.post('/api/gth/order-page/put-sale', {
									order_page_id: that.moneyform.order_page_id,
									status: 100
								})
								.then(response => {
									if (response.data.msg.code == 0) {
										//绑定分销商成功后上架（落基审核）
										if (this.shop_id == 50481 || this.shop_id == 304676) {
											that.$message({
												message: '商品已发起审核！',
												type: 'success'
											});
											that.$router.push({
												path: '/productionDelivery',
											})
										} else {
											that.$message({
												message: '商品发布成功！',
												type: 'success'
											});
											that.$router.push({
												path: '/productionDelivery',
											})
										}
									} else {
										that.$message.error(response.data.msg.info);
									}
								})

						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			},
      dataURLtoFile(dataurl, filename) {
        let arr = dataurl.split(","),
          mime = arr[0].match(/:(.*?);/)[1],
          bstr = atob(arr[1]),
          n = bstr.length,
          u8arr = new Uint8Array(n);
        while (n--) {
          u8arr[n] = bstr.charCodeAt(n);
        }
        return new File([u8arr], filename, {
          type: mime
        });
      },
			//单个图片上传
			uploadok: function(file) {
				var that = this;
        console.log(file.raw)
        var reader = new FileReader()
        var img = new Image();
        reader.onload = function(e) {
             img.src = e.target.result;
        };
        var canvas = document.createElement('canvas');
        var context = canvas.getContext('2d');
         // base64地址图片加载完毕后
        let p = new Promise((r,j)=>{
           img.onload = function () {
                // 图片原始尺寸
                var originWidth = this.width;
                var originHeight = this.height;
                // 最大尺寸限制
                var maxWidth = 1920, maxHeight = 10800;
                // 目标尺寸
                var targetWidth = originWidth, targetHeight = originHeight;
                // 图片尺寸超过400x400的限制
                if (originWidth > maxWidth || originHeight > maxHeight) {
                    if (originWidth / originHeight > maxWidth / maxHeight) {
                        // 更宽，按照宽度限定尺寸
                        targetWidth = maxWidth;
                        targetHeight = Math.round(maxWidth * (originHeight / originWidth));
                    } else {
                        targetHeight = maxHeight;
                        targetWidth = Math.round(maxHeight * (originWidth / originHeight));
                    }
                }
                // canvas对图片进行缩放
                canvas.width = targetWidth;
                canvas.height = targetHeight;
                // 清除画布
                context.clearRect(0, 0, targetWidth, targetHeight);
                // 图片压缩
                context.drawImage(img, 0, 0, targetWidth, targetHeight);

                let base64 = canvas.toDataURL("image/jpeg", 0.8); // 压缩后的base64图片
                let file2 = that.dataURLtoFile(base64, Date.parse(Date()) + ".jpg");
                r(file2)
           };
        })
        reader.readAsDataURL(file.raw);
        p.then(files=>{
          var formData = new FormData();
          formData.append("pic", files);
          axios.post('/api/plan-market/order-page/upload-pic', formData)
          	.then(response => {
          		if (response.data.msg.code == 0) {
          			that.shopform.image1 = response.data.data
          		} else {
          			that.$message.error(response.data.msg.info);
          		}
          	})
        })
			},
      uploadok2: function(file) {
      	var that = this;
        console.log(file.raw)
        var reader = new FileReader()
        var img = new Image();
        reader.onload = function(e) {
             img.src = e.target.result;
        };
        var canvas = document.createElement('canvas');
        var context = canvas.getContext('2d');
         // base64地址图片加载完毕后
        let p = new Promise((r,j)=>{
           img.onload = function () {
                // 图片原始尺寸
                var originWidth = this.width;
                var originHeight = this.height;
                // 最大尺寸限制
                var maxWidth = 1920, maxHeight = 10800;
                // 目标尺寸
                var targetWidth = originWidth, targetHeight = originHeight;
                // 图片尺寸超过400x400的限制
                if (originWidth > maxWidth || originHeight > maxHeight) {
                    if (originWidth / originHeight > maxWidth / maxHeight) {
                        // 更宽，按照宽度限定尺寸
                        targetWidth = maxWidth;
                        targetHeight = Math.round(maxWidth * (originHeight / originWidth));
                    } else {
                        targetHeight = maxHeight;
                        targetWidth = Math.round(maxHeight * (originWidth / originHeight));
                    }
                }
                // canvas对图片进行缩放
                canvas.width = targetWidth;
                canvas.height = targetHeight;
                // 清除画布
                context.clearRect(0, 0, targetWidth, targetHeight);
                // 图片压缩
                context.drawImage(img, 0, 0, targetWidth, targetHeight);

                let base64 = canvas.toDataURL("image/jpeg", 0.8); // 压缩后的base64图片
                let file2 = that.dataURLtoFile(base64, Date.parse(Date()) + ".jpg");
                r(file2)
           };
        })
        reader.readAsDataURL(file.raw);
        p.then(files=>{
          var formData = new FormData();
          formData.append("pic", files);
          axios.post('/api/plan-market/order-page/upload-pic', formData)
          	.then(response => {
          		if (response.data.msg.code == 0) {
          			that.shopform.share_img = response.data.data
                console.log(that.shopform.share_img)
          		} else {
          			that.$message.error(response.data.msg.info);
          		}
          	})
        })
      },
			//选择省市区
			changeaddress: function(v) {
				this.form.address_province = CodeToText[v[0]],
					this.form.address_city = CodeToText[v[1]],
					console.log("选中的省市" + this.form.address_province + this.form.address_city)
			},
			//导入敏感地区
			exportData: function(data) {
				console.log(data)
				this.mingan.citys = []
				this.mingan.fixcitys = []
				for (var i = 0; i < data.results.length; i++) {
					console.log(this.mingan.citys)
					this.mingan.citys.push(data.results[i]['敏感地区'])
					if (data.results[i]['修改敏感地区'].indexOf(",") > -1) {
						var arr = data.results[i]['修改敏感地区'].split(',')
					} else if (data.results[i]['修改敏感地区'].indexOf("，") > -1) {
						var arr = data.results[i]['修改敏感地区'].split('，')
					} else {
						return false
						that.$message.error("数据出错了，请检查格式");
					}
					var obj = {}
					obj[arr[0]] = arr[1]
					this.mingan.fixcitys.push(obj)
				}
			},
			//获取产品类型
			getproductstype: function() {
				var that = this
				axios.get("/api/gth/plan-type")
					.then(function(response) {
						if (response.data.msg.code == 0) {
							that.typelist = response.data.data
						} else {
							that.$message.error(response.data.msg.info);
						}

					})
			},

			loggo: function() {
				console.log("a")
			},

			//自定义产品类型
			handleClose(tag) {
				this.taglist.splice(this.taglist.indexOf(tag), 1);
			},

			showInput() {
				this.inputVisible = true;
				this.$nextTick(_ => {
					this.$refs.saveTagInput.$refs.input.focus();
				});
			},

			handleInputConfirm() {
				var that = this;
				var formData = new FormData();
				formData.append("name", this.inputValue);
				axios.post('/api/gth/plan-type/release', formData)
					.then(response => {
						if (response.data.msg.code == 0) {
							that.getproductstype();
							that.$message({
								message: '添加成功',
								type: 'success'
							});
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
				let inputValue = this.inputValue;
				if (inputValue) {
					this.taglist.push(inputValue);
				}
				this.inputVisible = false;
				this.inputValue = '';
			},
			//==================
			//打开选择分销商弹窗
			openchoosefx(from,item){
				this.fromtype = from
				this.isshowfxs = true
				this.fxtype = 1
				if(from==1){
					this.ids_t = JSON.parse(JSON.stringify(this.moneyform.child_shop_ids));
					console.log('编辑===')
					console.log(this.ids_t)
					//设置时候选中
					//给数组加ischecked
					this.moneyform.dislist = this.addischecked(this.moneyform.dislist)
				}else if(from==2){
					this.xin.order_page_id = this.moneyform.order_page_id
					if(item.type == 1){
					this.xin.config_id = 0
					}else{
					this.xin.config_id = item.id
					}
					this.xin.child_shop_id = ""

					//获取列表genjuguize
					axios.get('/api/plan-market/order-page/commissions?_page_size=2000&order_page_id='+this.moneyform.order_page_id+'&config_id='+this.xin.config_id)
					.then(response => {
						if(response.data.msg.code == 0){
							var arr = []
							for(var x=0;x<response.data.data.data.length;x++){
								arr.push(response.data.data.data[x].child_shop_id)
							}
							this.ids_t = arr
							console.log('佣金===')
							console.log(this.ids_t)
							//给数组加ischecked
							this.moneyform.dislist = this.addischecked(this.moneyform.dislist)

						}else{
							this.$message.error(response.data.msg.info);
						}
					})

				}
				// this.ids_t = JSON.parse(JSON.stringify(this.moneyform.child_shop_ids));
				// //设置时候选中
				// for(var x=0;x<this.moneyform.dislist.length;x++){
				// this.moneyform.dislist[x].ischecked = false
				// for(var y=0;y<this.ids_t.length;y++){
				// 	if(this.moneyform.dislist[x].child_shop_id==this.ids_t[y]){
				// 	this.moneyform.dislist[x].ischecked = true
				// 	}
				// }
				// }
			},
			//给数组加ischecked
			addischecked(arr){
				for(var x=0;x<arr.length;x++){
					arr[x].ischecked = false
					for(var y=0;y<this.ids_t.length;y++){
						if(arr[x].child_shop_id==this.ids_t[y]){
						arr[x].ischecked = true
						}
					}
				}
				return arr
			},
			//选择改变
			changechoose(e,item){
				// console.log(e)
				// console.log(item.child_shop_id)
				if(item=='全选'){
				if(this.fxtype==3){

					for(var y=0;y<this.fenzupeo.length;y++){

					this.fenzupeo[y].ischecked = e
					// 组-全选
					if(e){
						//全选
						if(!this.isarrhave(this.fenzupeo[y].child_shop_id)){
						this.ids_t.push(this.fenzupeo[y].child_shop_id)
						}
					}else{
						//全不选
						for(var x=0;x<this.ids_t.length;x++){
						if(this.fenzupeo[y].child_shop_id==this.ids_t[x]){
							this.ids_t.splice(x, 1)
						}
						}
					}
					}
				}else if(this.fxtype==5){
					for(var y=0;y<this.fentagpeo.length;y++){

					this.fentagpeo[y].ischecked = e
					// 标签-全选
					if(e){
						//全选
						if(!this.isarrhave(this.fentagpeo[y].child_shop_id)){
						this.ids_t.push(this.fentagpeo[y].child_shop_id)
						}
					}else{
						//全不选
						for(var x=0;x<this.ids_t.length;x++){
						if(this.fentagpeo[y].child_shop_id==this.ids_t[x]){
							this.ids_t.splice(x, 1)
						}
						}
					}
					}
				}
				}else{
				if(e){
					//选中当前
					if(!this.isarrhave(item.child_shop_id)){
					this.ids_t.push(item.child_shop_id)
					}
				}else{
					//取消当前
					for(var x=0;x<this.ids_t.length;x++){
					if(item.child_shop_id==this.ids_t[x]){
						this.ids_t.splice(x, 1)
					}
					}
				}
				}
			},
			//确认改变
			updatefx(){
				this.isshowfxs = false
				// this.moneyform.child_shop_ids = JSON.parse(JSON.stringify(this.ids_t));
				if(this.fromtype==1){
					this.moneyform.child_shop_ids = JSON.parse(JSON.stringify(this.ids_t));
				}else if(this.fromtype==2){

				}
			},
			//判断是否存在该数据
			isarrhave(id){
				var ishave = false
				for(var x=0;x<this.ids_t.length;x++){
				if(id==this.ids_t[x]){
					ishave = true
				}
				}
				return ishave
			},
			//删除选中标签
			closetag(id){
				console.log(id)
				for(var x=0;x<this.ids_t.length;x++){
					if(id==this.ids_t[x]){
						this.ids_t.splice(x, 1)
					}
				}
				for(var x=0;x<this.ids_t_s.length;x++){
					if(id==this.ids_t_s[x]){
						this.ids_t_s.splice(x, 1)
					}
				}
				this.moneyform.dislist = this.checkedfalse(this.moneyform.dislist,id)
				this.fenzupeo = this.checkedfalse(this.fenzupeo,id)
				this.fentagpeo = this.checkedfalse(this.fentagpeo,id)
				// for(var x=0;x<this.moneyform.dislist.length;x++){
				// 	if(this.moneyform.dislist[x].child_shop_id==id){
				// 		this.moneyform.dislist[x].ischecked = false
				// 	}
				// }
			},
			//删除标签，将ischecked改false
			checkedfalse(arr,id){
				for(var x=0;x<arr.length;x++){
					if(arr[x].child_shop_id==id){
					arr[x].ischecked = false
					}
				}
				return arr
			},
			//通过id翻译名字
			fanyi(id){
				for(var x=0;x<this.moneyform.dislist.length;x++){
				if(this.moneyform.dislist[x].child_shop_id==id){
					return this.moneyform.dislist[x].name
				}
				}
			},
			//点击分类
			changetype(type){
				this.fxtype = type
				if(type==2){
					this.fxtypetitle = '按分组选'
					//获取组列表
					this.getzulist()
				}else if(type==4){
					this.fxtypetitle = '按标签选'
					//获取标签list
					this.gettaglist()
				}
				this.searchallpeo = ''
			},
			//返回tab
			backtab(){
				if(this.fxtype==2){
					this.fxtype=1
					//给数组加ischecked
					this.moneyform.dislist = this.addischecked(this.moneyform.dislist)
				}else if(this.fxtype==3){
					this.fxtype=2
					this.fxtypetitle = '按分组选'
					//获取组列表
					this.getzulist()
				}else if(this.fxtype==4){
					this.fxtype=1
					//给数组加ischecked
					this.moneyform.dislist = this.addischecked(this.moneyform.dislist)
				}else if(this.fxtype==5){
					this.fxtype=4
					this.fxtypetitle = '按标签选'
					//获取标签list
					this.gettaglist()
				}
				this.searchallpeo = ''
			},
			//获取组列表
			getzulist(){
				this.fx_type_list = [
					{
						title:'xxx组',
						num:18,
					},
					{
						title:'xxx组',
						num:39,
					}
				]
			},
			//获取标签list
			gettaglist(){
				this.fx_type_list = [
					{
						title:'xxx标签',
						num:18,
					},
					{
						title:'xxx标签',
						num:39,
					}
				]
			},
			//组别或标签进成员
			getdetpeo(){
				if(this.fxtype==2){
					//进组别成员
					this.fxtype=3
					this.fxtypetitle = 'XXXX分组'
					this.fenzupeo = [
						{
						child_shop_id:50495,
						merchant_name:'唯一1级',
						name:'唯一1级'
						},
						{
						child_shop_id:50440,
						merchant_name:'lin3',
						name:'lin3'
						}
					]
					//给数组加ischecked
					this.fenzupeo = this.addischecked(this.fenzupeo)
					this.allfzpeocheck = false
				}else if(this.fxtype==4){
					//进标签成员
					this.fxtype=5
					this.fxtypetitle = '带有XXX标签的商户'
					this.fentagpeo = [
						{
						child_shop_id:50510,
						merchant_name:'娜娜旗舰店1',
						name:'娜娜旗舰店1'
						},
						{
						child_shop_id:303050,
						merchant_name:'测试2',
						name:'测试2'
						}
					]
					//给数组加ischecked
					this.fentagpeo = this.addischecked(this.fentagpeo)
					this.alltagpeocheck = false
				}
			},
			//已选成员筛选输入框
			shaitag(val){
				this.shaifun(this.ids_t,val)
			},
			//筛选方法
			shaifun(arr,font){
				var insearcharr = []
				for(var x = 0;x<arr.length;x++){
					if(this.fanyi(arr[x]).includes(font)){
						insearcharr.push(arr[x])
					}
				}
				this.ids_t_s = insearcharr
			},
			//筛选人员输入框
			shaipeo(val){
				if(this.fxtype==1){
					//全部
					this.shaipeofun(this.moneyform.dislist,val)
				}else if(this.fxtype==3){
					//组
					this.shaipeofun(this.fenzupeo,val)
				}else if(this.fxtype==5){
					//标签
					this.shaipeofun(this.fentagpeo,val)
				}
			},
			//筛选成员
			shaipeofun(arr,font){
				var insearcharr = []
				for(var x = 0;x<arr.length;x++){
					if(arr[x].merchant_name.includes(font)){
						insearcharr.push(arr[x])
					}
				}
				this.shaipeolist = insearcharr
			},
			// ======监听
			changesw(val){
				//修改自动转单
				console.log('监听')
				console.log(val)
				this.shopform.auto_transfer =val
			},
			surecreate(val){
				//设置转单目标商品：
				console.log('监听')
				console.log(val)
				var arr = []
				for(var x=0;x<val.length;x++){
					arr.push(val[x].id)
				}
				this.shopform.auto_transfer_pages =arr
			},
			handleChange(val){
				//设置转单订单来源
				console.log('监听')
				console.log(val)
				this.shopform.auto_transfer_sources =val
			}
		}

	}
</script>
<style scoped>
.t_choose_btn_box{
  display: flex;

}
.t_choose_type{
  background-color: #F2F2F2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 40px;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 10px;
  margin-top: 10px;
}
.t_choose_type img{
  height: 25px;
  margin-right: 10px;
}
.t_fx_item{
  margin-top: 28px;
  margin-bottom: 28px;
}
.t_fx_all{
  height: 300px;
  overflow: auto;
  border-right: 1px solid #E1E1E1;
  box-sizing: border-box;
}
.t_fenxiao_all{
  display: flex;
}
.t_fx_tab{
  width: 50%;
  box-sizing: border-box;
  padding: 10px;
}
.t_choose_tag{
  margin-right: 10px;
  margin-bottom: 10px;
}
.t_all_type_title{
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
  text-align: center;
  position: relative;
  margin-top: 10px;
}
.t_back_tab{
  cursor: pointer;
  position: absolute;
  left: 10px;
  top: 6px;
}
.t_type_list_item{
  display: flex;
  justify-content: space-between;
  padding: 10px 25px;
  box-sizing: border-box;
  cursor: pointer;
}
.t_out_tips_box{
  display: flex;
  align-items: center;
  margin-left: 20px;
}
.t_wen{
  background-color: #409EFF;
  color: white;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  margin-left: 10px;
  border-radius: 50%;
}
</style>
<style lang="scss" scoped>
	// .el-message-box__wrapper {
	// 	z-index: 20000 !important;
	// }
/deep/ .w-e-menu{ z-index: 1001 !important;}
  /deep/ .w-e-text-container{z-index: 1000 !important; }
.shangjia /deep/ .el-form-item__label{ font-weight: bold; color:#FF0000;}
	.index {


		/deep/ #editorE{position: relative; z-index: 9;}
		/deep/ #editor{ position: relative; z-index: 9;
			::v-deep .w-e-text-container{ z-index: 9;}
			::v-deep .w-e-toolbar .w-e-menu{ z-index: 9;}
		}
    /deep/ .el-input__inner {
    	width: 330px !important;
    }
     /deep/ .zidong .el-input__inner{ width: 100% !important;}
    .x{
      /deep/ .el-input__inner {
      	width: 200px !important;
      }
    }

    .zhouqi{
      /deep/ .el-input .el-input__inner{ width:120px !important;}
    }
		.zidingyiflex {
			display: flex;

			.zidingyitd {
				flex: 1;
				text-align: center;
				padding: 10px 10px;
				border: 1px #ccc solid;
				margin-left: -1px;
				margin-top: -1px;
			}
		}

		.bor3 {
			border: 1px #EAEAEA solid;
			background: #EAEAEA;
			padding: 10px;
			border-radius: 3px;
			margin-bottom: 10px;
		}

		.bor4 {
			border: 1px #EAEAEA solid;
			background: #EAEAEA;
			padding: 10px;
			border-radius: 3px;
			margin-bottom: 10px;
		}

		.newcon {
			width: 800px;
			border: 1px #EAEAEA solid;

			.newflex {
				display: flex;
				justify-content: center;
				align-items: center;
				text-align: center;
				border-bottom: 1px #EAEAEA solid;

				.newflexli1 {
					flex: 2;

					.newflexli11 {
						flex: 1;
						line-height: 36px;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					.newflexli12 {
						flex: 1;
						border-left: 1px #EAEAEA solid;

						/deep/ .el-input {
							width: 120px !important;
							margin: 5px 0;
						}
					}
				}

				.newflexli2 {
					flex: 1;
					border-left: 1px #EAEAEA solid;

					/deep/ .el-input {
						width: 60%  !important;
						margin: 5px 0;
					}
				}

				.newflex2 {
					display: flex;

					justify-content: center;
					align-items: center;
				}
			}

		}


		.loglist {
			display: flex;
			justify-content: space-between;
			margin-bottom: 30px;

			.log_title {
				padding: 7px 10px;
			}
		}

		.listl {
			height: 350px;
			overflow: auto;

			/deep/ .el-input__inner {
				border: none;
				text-align: center
			}
		}

		.list {

			display: flex;
			text-align: center;
			color: #727272;
			line-height: 45px;
			border: 1px #EAEAEA solid;
			margin-top: -1px;

			.th {
				flex: 1;
				background: #F9F9F9;
				font-size: 14px;
			}

			.td {
				flex: 1;
				font-size: 14px;
				border-right: 1px #EAEAEA solid;
			}
		}

		/deep/ .el-pagination {
			text-align: right;
			margin: 20px 0
		}

		// .el-dialog__wrapper {
		// 	z-index: 19999 !important;
		// }

		.protag {
			/deep/ .el-tag {
				margin-right: 20px;
				margin-bottom: 20px;
			}
		}

		.addpro {


			/deep/ .el-steps {

				padding: 30px;
			}

			.step {
				margin-bottom: 20px;
				background: #FFFFFF;

				/deep/ .el-step__icon {
					width: 36px;
					height: 36px;
				}

				/deep/ .el-step__line {
					top: 17px;
				}

				/deep/ .is-process {
					color: #C0C4CC;
					border-color: #C0C4CC;
					font-weight: 400
				}

				.redbor {
					/deep/ .el-input__inner {
						border: 1px #EEF7FF solid;
					}
				}

				.tilte {
					background: #F9F9F9;
					padding-left: 30px;
					line-height: 45px;
					font-size: 14px;

					span {
						background: #B1E4FF;
						color: #FFFFFF;
						float: right;
						line-height: 15px;
						cursor: pointer;
						padding: 5px 0;
						display: block;
						width: 24px;
						text-align: center;
						margin-right: 20px;
						margin-top: 8px;
						border-radius: 14px;
					}
				}





				.con {
					background: #FFFFFF;
					padding: 35px;

					.flex {
						display: flex;
					}

					.ori {
						background: #FBFBFB;
						padding: 20px 10px;

						/deep/ .el-input {
							width: 300px;
						}

						/deep/ .el-form-item {
							margin-bottom: 20px;
						}

						/deep/ .el-form-item__label {
							width: 150px !important;
						}

						.wenhao2 {
							color: #999;
							font-size: 14px;
						}

						.no {
							display: flex;
							align-items: center;

							#drop {
								/deep/ .el-button--primary {
									background: #409EFF
								}
							}

							.nonum {
								background: #409EFF;
								padding: 0px 10px;
								line-height: 35px;
								height: 35px;
								color: #FFFFFF;
								border-radius: 3px;
								display: block;
							}

							.el-button {}

							span {
								margin: 0 20px;
							}
						}

					}
				}

				.haochi {
					padding: 30px;

					/deep/ .el-select {
						margin-left: 20px;
					}
				}

				.btm0 {
					/deep/ .el-button {
						margin-left: 20px;
					}

					/deep/ .el-form-item {
						margin-bottom: 0;
					}
				}

				.label200 /deep/.el-form-item__label {
					width: 149px !important;
				}

				// /deep/ .avatar-uploader .el-upload {
				// 	border: 1px dashed #d9d9d9;
				// 	border-radius: 6px;
				// 	cursor: pointer;
				// 	position: relative;
				// 	overflow: hidden;
				// }

				// /deep/ .avatar-uploader .el-upload:hover {
				// 	border-color: #409EFF;
				// }

				// /deep/ .avatar-uploader-icon {
				// 	font-size: 28px;
				// 	color: #8c939d;
				// 	width: 178px;
				// 	height: 178px;
				// 	line-height: 178px;
				// 	text-align: center;
				// }

				// /deep/ .avatar {
				// 	width: 178px;
				// 	height: 178px;
				// 	display: block;
				// }

				.wenhao {
					background: #B1E4FF;
					color: #FFFFFF;
					line-height: 15px;
					cursor: pointer;
					padding: 5px 11px;
					margin-left: 20px;
					text-align: center;
					border-radius: 14px;
				}
			}

		}
	}
</style>
